Example #1
0
 /**
  * {@inheritdoc}
  */
 public function matchItem(ItemInterface $item)
 {
     $parent = $item->getParent();
     if (!$parent) {
         return false;
     }
     if ($this->condition) {
         return $this->condition->matchItem($parent);
     }
     return true;
 }
 /**
  * {@inheritdoc}
  */
 public function accept()
 {
     return $this->condition->matchItem($this->current());
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function matchItem(ItemInterface $item)
 {
     return !$this->condition->matchItem($item);
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function reduce(ConditionInterface $condition)
 {
     $item = $this->duplicate(false);
     $children = $item->getChildren();
     foreach ($this->children as $child) {
         if ($condition->matchItem($child)) {
             $children->add($child->reduce($condition));
         }
     }
     return $item;
 }