mirror of
https://github.com/jupeter/clean-code-php.git
synced 2025-09-30 16:09:03 +02:00
manager can manage several employees
This commit is contained in:
16
README.md
16
README.md
@@ -1222,16 +1222,18 @@ class Robot implements Employe
|
||||
|
||||
class Manager
|
||||
{
|
||||
private $employe;
|
||||
private $employees;
|
||||
|
||||
public function subdue(Employe $employe)
|
||||
{
|
||||
$this->employe = $employe;
|
||||
$this->employees[] = $employe;
|
||||
}
|
||||
|
||||
public function manage()
|
||||
{
|
||||
$this->employe->work();
|
||||
foreach ($this->employees as $employe) {
|
||||
$employe->work();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1277,16 +1279,18 @@ class Robot implements Workable
|
||||
|
||||
class Manager
|
||||
{
|
||||
private $employe;
|
||||
private $employees;
|
||||
|
||||
public function subdue(Workable $employe)
|
||||
{
|
||||
$this->employe = $employe;
|
||||
$this->employees[] = $employe;
|
||||
}
|
||||
|
||||
public function manage()
|
||||
{
|
||||
$this->employe->work();
|
||||
foreach ($this->employees as $employe) {
|
||||
$employe->work();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user