protected function decomposeRow(ConditionComposite $c) { if (false === empty($c->getORConditions())) { throw new InvalidArgumentException("in this test there should be no OR conditions"); } $result = []; foreach ($c->getANDConditions() as $c) { if ($c instanceof ConditionComposite) { throw new InvalidArgumentException("in this test there should be no composite"); } $result[] = $c; } return $result; }
/** * Gets all OR conditions of a composite and processes them through decompose(Condition). * * @param ConditionComposite $c * * @return array */ protected function decomposeORConditionsOf(ConditionComposite $c) { return array_reduce($c->getORConditions(), function (array $decomposed, Condition $c) { return array_merge($decomposed, $this->decompose($c)); }, []); }