Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function extractElementsByAnnotation($annotation, callable $skipClassCallback = null)
 {
     $elements = $this->elements->getEmptyList();
     $elements[Elements::METHODS] = [];
     $elements[Elements::PROPERTIES] = [];
     foreach ($this->elementStorage->getElements() as $type => $elementList) {
         $elementsForMain = $this->elementFilter->filterForMain($elementList);
         $elements[$type] += $this->elementFilter->filterByAnnotation($elementsForMain, $annotation);
         if ($type === Elements::CONSTANTS || $type === Elements::FUNCTIONS) {
             continue;
         }
         foreach ($elementList as $class) {
             /** @var ClassReflectionInterface $class */
             if (!$class->isMain()) {
                 continue;
             }
             if ($skipClassCallback && $skipClassCallback($class)) {
                 // in case when class is prior to it's elements
                 continue;
             }
             $elements[Elements::METHODS] = $this->extractByAnnotationAndMerge($class->getOwnMethods(), $annotation, $elements[Elements::METHODS]);
             $elements[Elements::CONSTANTS] = $this->extractByAnnotationAndMerge($class->getOwnConstants(), $annotation, $elements[Elements::CONSTANTS]);
             $elements[Elements::PROPERTIES] = $this->extractByAnnotationAndMerge($class->getOwnProperties(), $annotation, $elements[Elements::PROPERTIES]);
         }
     }
     return $this->sortElements($elements);
 }
Пример #2
0
 /**
  * @param string $groupName
  */
 private function addMissingElementTypes($groupName)
 {
     foreach ($this->elements->getAll() as $type) {
         if (!isset($this->groups[$groupName][$type])) {
             $this->groups[$groupName][$type] = [];
         }
     }
 }