1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<?php
namespace hji\membership\observers;
use hji\membership\interfaces\Loggable;
use hji\membership\Membership;
class EventLogger implements \SplObserver
{
private $logger;
public function __construct(Loggable $logger)
{
$this->logger = $logger;
}
public function update(\SplSubject $subject)
{
if ($event = $subject->getEvent())
{
$this->logger->log($event);
}
}
}