Example #1
0
 /**
  * {@inheritDoc}
  */
 public function match(EventInterface $event)
 {
     if ($this->isDeep && substr($event->getPath(), 0, strlen($this->absPath)) !== $this->absPath) {
         // isDeep is true and the node path does not start with the given path
         return false;
     } elseif (!$this->isDeep) {
         if ($event->getPath() !== $this->absPath) {
             // isDeep is false and the path is not the searched path
             return false;
         }
     }
     return true;
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function match(EventInterface $event)
 {
     if (!$event->getPath()) {
         // Some events (like PERSIST) do not contain a path
         return false;
     }
     // Algorithm:
     //  Construct the parent path
     //  If one of the nodes in $this->cachedNodesByUuid has that path then:
     //    It means the parent of the current node has one of the given UUID and the node must be kept
     //  Otherwise:
     //    Filter it out
     return $this->nodeIsCached($this->getParentPath($event->getPath()));
 }
Example #3
0
 /**
  * {@inheritDoc}
  */
 public function match(EventInterface $event)
 {
     if (!$event->getPath()) {
         // Some events (like PERSIST) don't have a path
         return false;
     }
     // An event might have been raised for a node that does not exist anymore
     if (!$this->session->nodeExists($event->getPath())) {
         return false;
     }
     $node = $this->session->getNode($event->getPath());
     foreach ($this->nodeTypes as $type) {
         if ($node->isNodeType($type)) {
             return true;
         }
     }
     return false;
 }
 /**
  * {@inheritDoc}
  */
 public function match(EventInterface $event)
 {
     return ($this->acceptedEventTypes & $event->getType()) === $event->getType();
 }
Example #5
0
 /**
  * @param EventInterface $event
  *
  * @return bool
  */
 private function skipByNodeTypes(EventInterface $event)
 {
     if (!($path = $event->getPath())) {
         // Some events (like PERSIST) do not provide an identifier
         return true;
     }
     try {
         $node = $this->session->getItem($path);
     } catch (PathNotFoundException $e) {
         return true;
     }
     if ($node instanceof PropertyInterface) {
         $node = $node->getParent();
     }
     foreach ($this->nodeTypes as $typename) {
         if ($node->isNodeType($typename)) {
             return false;
         }
     }
     return true;
 }