getOption() публичный Метод

public getOption ( $name )
 public function generate()
 {
     $annotations = $this->configuration->getOption(CO::ANNOTATION_GROUPS);
     foreach ($annotations as $annotation) {
         $template = $this->templateFactory->createNamedForElement(TemplateFactory::ELEMENT_ANNOTATION_GROUP, $annotation);
         $template = $this->setElementsWithAnnotationToTemplate($template, $annotation);
         $template->save();
     }
 }
 /**
  * @param string $fileName
  * @return string
  */
 public function getRelativePath($fileName)
 {
     foreach ($this->configuration->getOption(CO::SOURCE) as $directory) {
         if (strpos($fileName, $directory) === 0) {
             return $this->getFileNameWithoutSourcePath($fileName, $directory);
         }
     }
     throw new InvalidArgumentException(sprintf('Could not determine "%s" relative path', $fileName));
 }
Пример #3
0
 /**
  * @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;
 }
 /**
  * @return array
  */
 public function annotationFilter(array $annotations, array $customToRemove = [])
 {
     $annotations = $this->filterOut($annotations, $this->remove);
     $annotations = $this->filterOut($annotations, $customToRemove);
     if (!$this->configuration->getOption(CO::INTERNAL)) {
         unset($annotations['internal']);
     }
     if (!$this->configuration->getOption(CO::TODO)) {
         unset($annotations['todo']);
     }
     return $annotations;
 }
 /**
  * @return array
  */
 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->getOption(CO::MAIN));
     });
     return $this->groups;
 }
Пример #6
0
 /**
  * @param string $destination
  */
 public function copyToDestination($destination)
 {
     $resources = $this->configuration->getOption(CO::TEMPLATE)['resources'];
     foreach ($resources as $resourceSource => $resourceDestination) {
         // File
         if (is_file($resourceSource)) {
             copy($resourceSource, $this->fileSystem->forceDir($destination . '/' . $resourceDestination));
             continue;
         }
         // Dir
         /** @var RecursiveDirectoryIterator $iterator */
         $iterator = Finder::findFiles('*')->from($resourceSource)->getIterator();
         foreach ($iterator as $item) {
             /** @var SplFileInfo $item */
             copy($item->getPathName(), $this->fileSystem->forceDir($destination . '/' . $resourceDestination . '/' . $iterator->getSubPathName()));
         }
     }
 }
Пример #7
0
 /**
  * @param string $text
  * @return string
  */
 private function resolveInternalAnnotation($text)
 {
     $pattern = '~\\{@(\\w+)(?:(?:\\s+((?>(?R)|[^{}]+)*)\\})|\\})~';
     return preg_replace_callback($pattern, function ($matches) {
         if ($matches[1] !== 'internal') {
             return $matches[0];
         }
         if ($this->configuration->getOption(CO::INTERNAL) && isset($matches[2])) {
             return $matches[2];
         }
         return '';
     }, $text);
 }
 /**
  * @param ReflectionElement|ReflectionConstant $element
  * @param bool $withLine Include file line number into the link
  * @return string
  */
 public function sourceUrl(ReflectionElement $element, $withLine = TRUE)
 {
     $file = '';
     if ($this->isDirectUrl($element)) {
         $elementName = $element->getName();
         if ($element instanceof ReflectionClass) {
             $file = 'class-';
         } elseif ($element instanceof ReflectionConstant) {
             $file = 'constant-';
         } elseif ($element instanceof ReflectionFunction) {
             $file = 'function-';
         }
     } else {
         $elementName = $element->getDeclaringClassName();
         $file = 'class-';
     }
     $file .= $this->urlize($elementName);
     $url = sprintf($this->configuration->getOption(CO::TEMPLATE)['templates']['source']['filename'], $file);
     if ($withLine) {
         $url .= $this->getElementLinesAnchor($element);
     }
     return $url;
 }
Пример #9
0
 private function reportParserErrors(array $errors)
 {
     /** @var FileProcessingException[] $errors */
     foreach ($errors as $error) {
         $output = null;
         if ($this->configuration->getOption('debug')) {
             $output = $error->getDetail();
         } else {
             /** @var \Exception[] $reasons */
             $reasons = $error->getReasons();
             if (isset($reasons[0]) && count($reasons)) {
                 $output = $reasons[0]->getMessage();
             }
         }
         if ($output) {
             $this->io->writeln(sprintf('<error>Parse error: "%s"</error>', $output));
         }
     }
 }
 /**
  * @param string $name
  * @return string
  */
 public function namespaceUrl($name)
 {
     return sprintf($this->configuration->getOption(CO::TEMPLATE)['templates']['namespace']['filename'], $this->urlize($name));
 }
Пример #11
0
 /**
  * {@inheritdoc}
  */
 public function isAllowed()
 {
     return (bool) $this->configuration->getOption(CO::DOWNLOAD);
 }
Пример #12
0
 /**
  * @return string
  */
 private function getDestination()
 {
     return $this->configuration->getOption(CO::DESTINATION);
 }
 /**
  * @return bool
  */
 public function isAllowed()
 {
     return (bool) $this->configuration->getOption(CO::BASE_URL);
 }
Пример #14
0
 /**
  * {@inheritdoc}
  */
 public function isAllowed()
 {
     return $this->configuration->getOption(CO::TREE);
 }
Пример #15
0
 /**
  * {@inheritdoc}
  */
 public function isAllowed()
 {
     return $this->configuration->getOption(CO::SOURCE_CODE);
 }
 /**
  * @param string $name
  * @return string
  */
 public function createForAnnotationGroup($name)
 {
     return sprintf($this->configuration->getOption(CO::TEMPLATE)['templates'][TCO::ANNOTATION_GROUP]['filename'], Filters::urlize($name));
 }