2014-03-02 21:54:04 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace DesignPatterns\Delegation;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class TeamLead
|
|
|
|
* @package DesignPatterns\Delegation
|
|
|
|
* The `TeamLead` class, he delegate work to `JuniorDeveloper`
|
|
|
|
*/
|
|
|
|
class TeamLead
|
|
|
|
{
|
2014-03-02 22:24:19 +04:00
|
|
|
/** @var JuniorDeveloper */
|
|
|
|
protected $slave;
|
2014-03-02 21:54:04 +04:00
|
|
|
|
2014-03-02 22:24:19 +04:00
|
|
|
/**
|
|
|
|
* Give junior developer into teamlead submission
|
|
|
|
* @param JuniorDeveloper $junior
|
|
|
|
*/
|
|
|
|
public function __construct(JuniorDeveloper $junior)
|
|
|
|
{
|
|
|
|
$this->slave = $junior;
|
|
|
|
}
|
2014-03-02 21:54:04 +04:00
|
|
|
|
2014-03-02 22:24:19 +04:00
|
|
|
/**
|
|
|
|
* TeamLead drink coffee, junior work
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function writeCode()
|
|
|
|
{
|
|
|
|
return $this->slave->writeBadCode();
|
|
|
|
}
|
2014-03-02 21:54:04 +04:00
|
|
|
}
|