/** * Invert the logical meaning of this assertion * * @return bool */ public function invert() { if ($this->inverted === true) { $this->inverted = false; } else { $this->inverted = true; } // Iterate over all assertions and invert them. $iterator = $this->assertionList->getIterator(); for ($i = 0; $i < $iterator->count(); $i++) { // Get the string representation of this assertion $iterator->current()->invert(); // Move the iterator $iterator->next(); } // Now invert all combinators. foreach ($this->combinators as $key => $combinator) { if (isset($this->inversionMapping[$combinator])) { $this->combinators[$key] = $this->inversionMapping[$combinator]; } } return true; }
/** * Will flatten all conditions available at the time of the call. * That means this method will check which conditions make sense in an inheritance context and will drop the * others. * * @return bool */ public function flattenConditions() { // As our lists only supports unique entries anyway, the only thing left is to check if the condition's // assertions can be fulfilled (would be possible as direct assertions), and flatten the contained // function definitions as well $ancestralConditionIterator = $this->ancestralInvariants->getIterator(); foreach ($ancestralConditionIterator as $conditionList) { // iterate all condition lists $conditionListIterator = $conditionList->getIterator(); foreach ($conditionListIterator as $assertion) { } } // No flatten all the function definitions we got $functionDefinitionIterator = $this->functionDefinitions->getIterator(); foreach ($functionDefinitionIterator as $functionDefinition) { // iterate over all function definitions $functionDefinition->flattenConditions(); } return false; }