<?php
public function calculateDepartmentTotalSalary() {
$totalSalary = 0;
foreach ($this->employees as $key => $Employee) {
$totalSalary += $Employee->salary; //Department.php line 30
}
return $totalSalary;
}
=====================================
class Employee {
public $name;
public $rang;
public $salary;
public $coffee;
public $document;
public $leader;
public function __construct($name, $salary, $coffee, $document, $rang = 1, $leader = false) {
$this->name = $name;
$this->salary = $salary;
$this->coffee = $coffee;
$this->document = $document;
$this->rang = $rang;
$this->leader = $leader;
$this->salary = $this->calculateSalary();
$this->coffee = $this->calculateCoffee();
$this->document = $this->calculateDocument();
}
PD9waHAKcHVibGljIGZ1bmN0aW9uIGNhbGN1bGF0ZURlcGFydG1lbnRUb3RhbFNhbGFyeSgpIHsKCSR0b3RhbFNhbGFyeSA9IDA7CgoJZm9yZWFjaCAoJHRoaXMtPmVtcGxveWVlcyBhcyAka2V5ID0+ICRFbXBsb3llZSkgewoJCSR0b3RhbFNhbGFyeSArPSAkRW1wbG95ZWUtPnNhbGFyeTsgLy9EZXBhcnRtZW50LnBocCBsaW5lIDMwCgl9CgoJcmV0dXJuICR0b3RhbFNhbGFyeTsKfQoKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpjbGFzcyBFbXBsb3llZSB7CglwdWJsaWMgJG5hbWU7CgoJcHVibGljICRyYW5nOwoJcHVibGljICRzYWxhcnk7CglwdWJsaWMgJGNvZmZlZTsKCXB1YmxpYyAkZG9jdW1lbnQ7CglwdWJsaWMgJGxlYWRlcjsKCglwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoJG5hbWUsICRzYWxhcnksICRjb2ZmZWUsICRkb2N1bWVudCwgJHJhbmcgPSAxLCAkbGVhZGVyID0gZmFsc2UpIHsKCQkkdGhpcy0+bmFtZSA9ICRuYW1lOwoJCSR0aGlzLT5zYWxhcnkgPSAkc2FsYXJ5OwoJCSR0aGlzLT5jb2ZmZWUgPSAkY29mZmVlOwoJCSR0aGlzLT5kb2N1bWVudCA9ICRkb2N1bWVudDsKC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