/** * {@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); }
/** * {@inheritdoc} */ public function getElements() { foreach ($this->elementStorage->getElements() as $type => $elementList) { foreach ($elementList as $element) { $this->processElement($element); } } $this->sortElements(); return $this->elements; }
public function generate() { foreach ($this->elementStorage->getElements() as $type => $elementList) { foreach ($elementList as $element) { /** @var ElementReflectionInterface $element */ if ($element->isTokenized()) { $this->generateForElement($element); $this->eventDispatcher->dispatch(new GenerateProgressEvent(GeneratorEvents::ON_GENERATE_PROGRESS)); } } } }