Jackalope\Observation\EventFilter::match PHP Method

match() public method

{@inheritDoc}
public match ( PHPCR\Observation\EventInterface $event )
$event PHPCR\Observation\EventInterface
    public function match(EventInterface $event)
    {
        if (null !== $this->eventTypes) {
            if ($this->skipByType($event)) {
                return false;
            }
        }
        if (null !== $this->absPath) {
            if ($this->skipByPath($event)) {
                return false;
            }
        }
        if (null !== $this->identifiers) {
            if ($this->skipByIdentifiers($event)) {
                return false;
            }
        }
        if (null !== $this->nodeTypes) {
            if ($this->skipByNodeTypes($event)) {
                return false;
            }
        }
        if ($this->noLocal) {
            throw new \Jackalope\NotImplementedException();
            if ($this->skipByNoLocal($event)) {
                return false;
            }
        }
        return true;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Parse the events in an <entry> section
  *
  * @param DOMElement $entry
  * @param string     $currentUserId The current user ID as extracted from
  *      the <entry> part
  *
  * @return Event[]
  */
 protected function extractEvents(DOMElement $entry, $currentUserId)
 {
     $events = array();
     $domEvents = $entry->getElementsByTagName('event');
     foreach ($domEvents as $domEvent) {
         $event = $this->factory->get('Jackalope\\Observation\\Event', array($this->nodeTypeManager));
         $event->setType($this->extractEventType($domEvent));
         $date = $this->getDomElement($domEvent, 'eventdate', 'The event date was not found while building the event journal:\\n' . $this->getEventDom($domEvent));
         $event->setUserId($currentUserId);
         // The timestamps in Java contain milliseconds, it's not the case in PHP
         // so we strip millis from the response
         $event->setDate(substr($date->nodeValue, 0, -3));
         $id = $this->getDomElement($domEvent, 'eventidentifier');
         if ($id) {
             $event->setIdentifier($id->nodeValue);
         }
         $href = $this->getDomElement($domEvent, 'href');
         if ($href) {
             $path = str_replace($this->workspaceRootUri, '', $href->nodeValue);
             if (substr($path, -1) === '/') {
                 // Jackrabbit might return paths with trailing slashes. Eliminate them if present.
                 $path = substr($path, 0, -1);
             }
             $event->setPath($path);
         }
         $primaryNodeType = $this->getDomElement($domEvent, 'eventprimarynodetype');
         if ($primaryNodeType) {
             $event->setPrimaryNodeTypeName($primaryNodeType->nodeValue);
         }
         $mixinNodeTypes = $domEvent->getElementsByTagName('eventmixinnodetype');
         foreach ($mixinNodeTypes as $mixinNodeType) {
             $event->addMixinNodeTypeName($mixinNodeType->nodeValue);
         }
         $userData = $this->getDomElement($domEvent, 'eventuserdata');
         if ($userData) {
             $event->setUserData($userData->nodeValue);
         }
         $eventInfos = $this->getDomElement($domEvent, 'eventinfo');
         if ($eventInfos) {
             foreach ($eventInfos->childNodes as $info) {
                 if ($info->nodeType == XML_ELEMENT_NODE) {
                     $event->addInfo($info->tagName, $info->nodeValue);
                 }
             }
         }
         // abort if we got more events than expected (usually on paging)
         if ($event->getDate() > $this->creationMillis) {
             $this->nextMillis = false;
             return $events;
         }
         if ($this->filter->match($event)) {
             $events[] = $event;
         }
     }
     return $events;
 }
All Usage Examples Of Jackalope\Observation\EventFilter::match