Example #1
0
 /**
  * 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);
     }
 }
Example #2
0
 /**
  * Add a publisher to our list of listened to publishers
  * 
  * Make sure we listen to it
  * 
  * @param Falcraft\Patterns\Resource\PublisherInterface $publisher
  * 
  */
 public function addPublisher(PatternsResource\PublisherInterface $publisher)
 {
     $publisher->attachListener($this);
 }