public function generate()
 {
     $annotations = $this->configuration->getOption('annotationGroups');
     foreach ($annotations as $annotation) {
         $template = $this->templateFactory->createNamedForElement(TemplateFactory::ELEMENT_ANNOTATION_GROUP, $annotation);
         $template = $this->setElementsWithAnnotationToTemplate($template, $annotation);
         $template->save();
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function sort(array $groups)
 {
     if ($this->isNoneGroupOnly($groups)) {
         return [];
     }
     $this->groups = $groups;
     $groupNames = array_keys($groups);
     $this->lowercasedGroupNames = $this->convertGroupNamesToLower($groupNames);
     foreach ($groupNames as $groupName) {
         $this->addMissingParentGroups($groupName);
         $this->addMissingElementTypes($groupName);
     }
     uksort($this->groups, function ($one, $two) {
         return $this->compareGroups($one, $two, $this->configuration->getMain());
     });
     return $this->groups;
 }
Exemplo n.º 3
0
 /**
  * @param ElementReflectionInterface $element
  * @param bool $withLine Include file line number into the link
  * @return string
  */
 public function sourceUrl(ElementReflectionInterface $element, $withLine = TRUE)
 {
     $file = '';
     if ($this->isDirectUrl($element)) {
         $elementName = $element->getName();
         if ($element instanceof ClassReflectionInterface) {
             $file = 'class-';
         } elseif ($element instanceof ConstantReflectionInterface) {
             $file = 'constant-';
         } elseif ($element instanceof FunctionReflectionInterface) {
             $file = 'function-';
         }
     } else {
         $elementName = $element->getDeclaringClassName();
         $file = 'class-';
     }
     $file .= $this->urlize($elementName);
     $url = sprintf($this->configuration->getOption('template')['templates']['source']['filename'], $file);
     if ($withLine) {
         $url .= $this->getElementLinesAnchor($element);
     }
     return $url;
 }
Exemplo n.º 4
0
 private function sortNamespacesAndPackages()
 {
     $areNamespacesEnabled = $this->configuration->areNamespacesEnabled($this->getNamespaceCount(), $this->getPackageCount());
     $arePackagesEnabled = $this->configuration->arePackagesEnabled($areNamespacesEnabled);
     if ($areNamespacesEnabled) {
         $this->namespaces = $this->groupSorter->sort($this->namespaces);
         $this->packages = [];
     } elseif ($arePackagesEnabled) {
         $this->namespaces = [];
         $this->packages = $this->groupSorter->sort($this->packages);
     } else {
         $this->namespaces = [];
         $this->packages = [];
     }
 }
Exemplo n.º 5
0
 /**
  * @param string $name
  * @return string
  */
 public function createForAnnotationGroup($name)
 {
     return sprintf($this->configuration->getOption(CO::TEMPLATE)['templates'][TCO::ANNOTATION_GROUP]['filename'], Filters::urlize($name));
 }