/** * {@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()); }
/** * {@inheritdoc} */ public function matchItem(ItemInterface $item) { return !$this->condition->matchItem($item); }
/** * {@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; }