<?php
abstract class AbstractWorker
{
protected $startSalary;
public $coffee;
public $pages;
public $rank = 1;
protected function getSalary()
{
if ($rank = 1)
{
$salary = $startSalary;
}
elseif ($rank = 2)
{
$salary = $startSalary * 1.25;
}
elseif ($rank = 3)
{
$salary = $startSalary * 1.50;
} else
{
echo "Слава Украине!";
}
return $salary;
}
public $salary = getSalary;
}
class ManagerWorker extends AbstractWorker
{
protected $startSalary = 500;
public $coffee = 20;
public $pages = 200;
public $rank = 1;
protected function getSalary($rank)
{
if ($rank = 1)
{
$salary = $startSalary;
}
elseif ($rank = 2)
{
$salary = $startSalary * 1.25;
}
elseif ($rank = 3)
{
$salary = $startSalary * 1.50;
} else
{
echo "Слава Украине!";
}
return $salary;
}
public $salary = $this->getSalary();
}
$worker = new ManagerWorker;
PD9waHAKCmFic3RyYWN0IGNsYXNzIEFic3RyYWN0V29ya2VyIAp7CiAgICBwcm90ZWN0ZWQgJHN0YXJ0U2FsYXJ5OwoJcHVibGljICRjb2ZmZWU7CglwdWJsaWMgJHBhZ2VzOwoJcHVibGljICRyYW5rID0gMTsKCXByb3RlY3RlZCBmdW5jdGlvbiBnZXRTYWxhcnkoKQoJewoJCWlmICgkcmFuayA9IDEpCgkJewoJCSRzYWxhcnkgPSAkc3RhcnRTYWxhcnk7CgkJfSAKCQllbHNlaWYgKCRyYW5rID0gMikgCgkJewoJCQkkc2FsYXJ5ID0gJHN0YXJ0U2FsYXJ5ICogMS4yNTsKCQl9IAoJCWVsc2VpZiAoJHJhbmsgPSAzKSAKCQl7CgkJCSRzYWxhcnkgPSAkc3RhcnRTYWxhcnkgKiAxLjUwOwoJCX0gZWxzZSAKCQl7CgkJCWVjaG8gItCh0LvQsNCy0LAg0KPQutGA0LDQuNC90LUhIjsKCQl9CgkJcmV0dXJuICRzYWxhcnk7Cgl9CglwdWJsaWMgJHNhbGFyeSA9IGdldFNhbGFyeTsKfQoKY2xhc3MgTWFuYWdlcldvcmtlciBleHRlbmRzIEFic3RyYWN0V29ya2Vy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