/** * The Observer Constructor * * This takes an optional publisher that the observer can attach itself to * * @param Falcraft\Pattern\Resource\PublisherInterface $subject * */ public function __construct(PatternsResource\PublisherInterface $subject = null) { $restrictions = new Types\Restrictions(array(Type::BASIC_NULL, Type::TYPED_OBJECT), array('Falcraft\\Patterns\\Resource\\PublisherInterface'), array('strict' => true)); $this->subject = new Types\RestrictedSet(array(), $restrictions, array('strict' => true)); if ($subject) { $subject->attachListener($this); } }
/** * Remove a publisher from the list of listened to publishers * * Make sure we stop listening to it * * The remove function is in here because the detach function doesn't * take an argument for what publisher to remove. * * @param Falcraft\Patterns\Resource\PublisherInterface $publisher * */ public function removePublisher(PatternsResource\PublisherInterface $publisher) { $publisher->detachListener($this); }