/**
  * 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;
 }
 /**
  * Parse assertions which are a collection of others
  *
  * @param string $combinator How are they combinded? E.g. "||"
  * @param string $docString  The DocBlock piece to search in
  *
  * @throws \TechDivision\PBC\Exceptions\ParserException
  *
  * @return \TechDivision\PBC\Entities\Assertions\ChainedAssertion
  */
 protected function parseChainedAssertion($combinator, $docString)
 {
     // Get all the parts of the string
     $assertionArray = explode(' ', $docString);
     // Check all string parts for the | character
     $combinedPart = '';
     $combinedIndex = 0;
     foreach ($assertionArray as $key => $assertionPart) {
         // Check which part contains the | but does not only consist of it
         if ($this->filterOrCombinator($assertionPart) && trim($assertionPart) !== '|') {
             $combinedPart = trim($assertionPart);
             $combinedIndex = $key;
             break;
         }
     }
     // Check if we got anything of value
     if (empty($combinedPart)) {
         throw new ParserException('Error parsing what seems to be a |-combined assertion ' . $docString);
     }
     // Now we have to create all the separate assertions for each part of the $combinedPart string
     $assertionList = new AssertionList();
     foreach (explode('|', $combinedPart) as $partString) {
         // Rebuild the assertion string with one partial string of the combined part
         $tmp = $assertionArray;
         $tmp[$combinedIndex] = $partString;
         $assertion = $this->parseAssertion(implode(' ', $tmp));
         if (is_bool($assertion)) {
             continue;
         } else {
             $assertionList->add($assertion);
         }
         $assertion = false;
     }
     // We got everything. Create a ChainedAssertion instance
     return new ChainedAssertion($assertionList, '||');
 }