<?php

abstract class Employee{
	
	public $salary;
	public $pages;
	public $cofee;
	public $name;
	
	
	function __construct($quantity, $rank){
		
	    $this->quantity = $quantity;
	    $this->rank = $rank;
	}
	
	function getSalary(){
		$multiply=1;
		switch($this->rank){
			case 2:
				$multiply=1.25;
				break;
			case 3:
				$multiply=1.50;
				break;
		}
		$getSalary=$this->salary*$multiply*$this->quantity;
		return $getSalary;
	}
	
	function getCofee(){
		$getCofee=$this->quantity*$this->cofee;
		return $getCofee;
	}
	
	function getPages(){
		$getPages=$this->quantity*$this->pages;
		return $getPages;
	}
	
}

class Manager extends Employee{
	public $name="Менеджер";
	public $salary = 500;
	public $cofee = 20;
	public $pages = 200;
}

class Market extends Employee{
	public $name = "Маркетолог";
	public $salary = 400;
	public $cofee = 15;
	public $pages = 150;
}

class Engineer extends Employee {
	public $name = "Инженер";
	public $salary = 200;
	public $cofee = 5;
	public $pages = 50;
}

class Analyst extends Employee {
	public $name = "Аналитик";
	public $salary = 800;
	public $cofee = 50;
	public $pages = 5;
}


class Department{
	public $workers;
	public $costs;
    
    function __construct($name){
    	$this->name = $name;
    	return $this->name;
    }
}

$department1= array(
	new Manager(9, 1),
	new Manager(3, 2),
	new Manager(2, 3),
	new Market(2, 1),
	'name'=>'закупок'
	);
	
	
	function createDepartment($data){
     $department = new Department($data['name']);
     foreach($data as $key=> $workers){
     	if($key=='name'){
     		continue;
     	}
     echo $key;
     }
    
	}
	
createDepartment($department1);
