getSubject() public method

public getSubject ( ) : string
return string
Ejemplo n.º 1
0
    public function testCall()
    {
        $xml = '<event key="core/object/modify" subject="core:domain">
  <call>core/test</call>
</event>';
        $event = new Event($xml, $this->getJarves());
        $this->assertEquals('core/object/modify', $event->getKey());
        $this->assertEquals('core:domain', $event->getSubject());
        $this->assertEquals(['core/test'], $event->getCalls());
        $this->assertEquals($xml, $event->toXml());
    }
Ejemplo n.º 2
0
 /**
  * Checks whether a eventConfig is appropriate to be called (subject fits, condition fits)
  *
  * @param Event $eventConfig
  * @param GenericEvent $event
  * @return bool
  */
 public function isCallable(Event $eventConfig, GenericEvent $event)
 {
     if ($eventConfig->getSubject() && $event->getSubject() != $eventConfig->getSubject()) {
         return false;
     }
     if ($eventConfig->getCondition()) {
         $args = $event->getArguments() ?: [];
         if ($eventConfig->getCondition() && !$this->conditionOperator->satisfy($eventConfig->getCondition(), $args)) {
             return false;
         }
     }
     return true;
 }