Beispiel #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);
 }
 /**
  * {@inheritdoc}
  */
 public function getElements()
 {
     foreach ($this->elementStorage->getElements() as $type => $elementList) {
         foreach ($elementList as $element) {
             $this->processElement($element);
         }
     }
     $this->sortElements();
     return $this->elements;
 }
 /**
  * @return array
  */
 private function getParameters()
 {
     if ($this->parameters === null) {
         $parameters = ['annotationGroups' => $this->configuration->getOption(CO::ANNOTATION_GROUPS), 'namespace' => null, 'package' => null, 'class' => null, 'constant' => null, 'function' => null, 'namespaces' => array_keys($this->elementStorage->getNamespaces()), 'packages' => array_keys($this->elementStorage->getPackages()), 'classes' => array_filter($this->elementStorage->getClasses(), $this->getMainFilter()), 'interfaces' => array_filter($this->elementStorage->getInterfaces(), $this->getMainFilter()), 'traits' => array_filter($this->elementStorage->getTraits(), $this->getMainFilter()), 'exceptions' => array_filter($this->elementStorage->getExceptions(), $this->getMainFilter()), 'constants' => array_filter($this->elementStorage->getConstants(), $this->getMainFilter()), 'functions' => array_filter($this->elementStorage->getFunctions(), $this->getMainFilter()), 'elements' => $this->autocompleteElements->getElements()];
         if ($this->configuration->getOption(CO::DOWNLOAD)) {
             $parameters['archive'] = basename($this->configuration->getZipFileName());
         }
         $this->parameters = $parameters;
     }
     return $this->parameters;
 }
 /**
  * {@inheritdoc}
  */
 public function getStepCount()
 {
     $tokenizedFilter = function (ClassReflectionInterface $class) {
         return $class->isTokenized();
     };
     $count = count(array_filter($this->elementStorage->getClasses(), $tokenizedFilter)) + count(array_filter($this->elementStorage->getInterfaces(), $tokenizedFilter)) + count(array_filter($this->elementStorage->getTraits(), $tokenizedFilter)) + count(array_filter($this->elementStorage->getExceptions(), $tokenizedFilter)) + count($this->elementStorage->getConstants()) + count($this->elementStorage->getFunctions());
     return $count;
 }
 /**
  * {@inheritdoc}
  */
 public function isAllowed()
 {
     return (bool) $this->elementStorage->getNamespaces();
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function isAllowed()
 {
     return (bool) $this->elementStorage->getPackages();
 }