DesignPatternsPHP/Mediator/Colleague.php
Dominik Liebler 8b82ed198d cs
2013-09-13 14:19:55 +02:00

33 lines
658 B
PHP

<?php
namespace DesignPatterns\Mediator;
/**
* Colleague is an abstract colleague who works together but he only knows
* the Mediator, not other colleague.
*/
abstract class Colleague
{
/**
* this ensures no change in subclasses
*
* @var MediatorInterface
*/
private $mediator;
// for subclasses
protected function getMediator()
{
return $this->mediator;
}
/**
* @param MediatorInterface $medium
*/
public function __construct(MediatorInterface $medium)
{
// in this way, we are sure the concrete colleague knows the mediator
$this->mediator = $medium;
}
}