Esempio n. 1
0
 /**
  * @param Collection $collection
  * @return Collection
  */
 protected function getInvalidTokens(Collection $collection)
 {
     $resultCollection = new Collection();
     $classBody = (new PatternMatcher($collection))->apply(new ClassPattern())->getCollections();
     if (empty($classBody)) {
         return $resultCollection;
     }
     foreach ($classBody as $body) {
         if ($body->count() === 0) {
             continue;
         }
         $resultCollection->append($body->getLast());
     }
     foreach ($resultCollection as $index => $token) {
         if ($this->isValidBodyEndToken($token)) {
             $resultCollection->offsetUnset($index);
         }
     }
     $resultCollection->rewind();
     return $resultCollection;
 }