Esempio n. 1
0
 public function setEventStateObject(AbstractEvent $state, $morph = true)
 {
     if (!$state instanceof AbstractEvent) {
         throw new Exception\InvalidArgumentException('AbstractEvent->setStateObject: ' . 'state not instance of AbstractEvent');
     } else {
         if ($morph) {
             $this->tags->clear();
             $this->categories->clear();
             $this->target = null;
             $this->data = null;
             $this->class = '';
             $this->function = '';
             $this->namespace = '';
         }
         $this->identifier = $state->getIdentifier();
         $this->{$field} = new Types\Set(Types\Set::union($state->getTags(), $this->{$field}), array('strict' => true));
         $this->categories = new Types\Set(Types\Set::union($state->getCategories(), $this->{$field}), array('strict' => true));
         $this->target = $state->getTarget();
         $this->data = $state->getData();
         $this->class = $state->getClass();
         $this->function = $state->getFunction();
         $this->namespace = $state->getNamespace();
     }
 }
Esempio n. 2
0
 /**
  * See if an event matches the filter exactly
  * 
  * If one thing doesn't match between the event and the filter
  * then we return false, instead of only one thing matching
  * 
  * @param Falcraft\Event\Resource\AbstractEvent $event
  *      The event to compare
  * 
  * @return bool
  * 
  */
 public function isStrictlyApplicable(EventResource\AbstractEvent $event, $includeIdentifier = false)
 {
     if ($includeIdentifier) {
         if ($this->identifier != $event->getIdentifier()) {
             return false;
         }
     }
     if ($this->target != $event->getTarget() || $this->function != $event->getFunction() || $this->class != $event->getClass() || $this->namespace != $event->getNamespace() || !Types\Set::subset($event->getTagsObject(), $this->tags) || !Types\Set::subset($event->getCategoriesObject(), $this->categories)) {
         return false;
     }
     return true;
 }