diff --git a/src/Builder/NamespaceIndexBuilder.php b/src/Builder/NamespaceIndexBuilder.php index 4ac33d8..e029fee 100755 --- a/src/Builder/NamespaceIndexBuilder.php +++ b/src/Builder/NamespaceIndexBuilder.php @@ -74,15 +74,21 @@ private function findChildNamespaces() /** @var Namespace_ $namespace */ foreach ($this->namespaces as $namespace) { // check if not root and doesn't start with current namespace - if ($currentNamespaceFqsen !== '\\' && strpos((string) $namespace->getFqsen(), - $currentNamespaceFqsen.'\\') !== 0) { + if ($currentNamespaceFqsen !== '\\' && strpos( + (string) $namespace->getFqsen(), + $currentNamespaceFqsen.'\\' + ) !== 0) { continue; } - if ((string) $namespace->getFqsen() !== $currentNamespaceFqsen && strpos((string) $namespace->getFqsen(), - $currentNamespaceFqsen) === 0) { + if ((string) $namespace->getFqsen() !== $currentNamespaceFqsen && strpos( + (string) $namespace->getFqsen(), + $currentNamespaceFqsen + ) === 0) { // only keep first level children - $childrenPath = substr((string) $namespace->getFqsen(), - strlen((string) $this->currentNamespace->getFqsen()) + 1); + $childrenPath = substr( + (string) $namespace->getFqsen(), + strlen((string) $this->currentNamespace->getFqsen()) + 1 + ); if (strpos($childrenPath, '\\') === false) { $this->childNamespaces[] = $namespace; } @@ -188,11 +194,11 @@ private function getElementList($type) private function getHeaderForType($type) { $headers = [self::RENDER_INDEX_NAMESPACE => 'Namespaces', - self::RENDER_INDEX_INTERFACES => 'Interfaces', - self::RENDER_INDEX_CLASSES => 'Classes', - self::RENDER_INDEX_TRAITS => 'Traits', - self::RENDER_INDEX_FUNCTIONS => 'Functions', - self::RENDER_INDEX_CONSTANTS => 'Constants', + self::RENDER_INDEX_INTERFACES => 'Interfaces', + self::RENDER_INDEX_CLASSES => 'Classes', + self::RENDER_INDEX_TRAITS => 'Traits', + self::RENDER_INDEX_FUNCTIONS => 'Functions', + self::RENDER_INDEX_CONSTANTS => 'Constants', ]; return $headers[$type]; @@ -202,8 +208,11 @@ private function addElementTocEntry(Fqsen $entry) { $currentNamespaceFqsen = (string) $this->currentNamespace->getFqsen(); $subPath = $entry; - if ($currentNamespaceFqsen !== '\\' && substr($entry, 0, - strlen($currentNamespaceFqsen)) === $currentNamespaceFqsen) { + if ($currentNamespaceFqsen !== '\\' && substr( + $entry, + 0, + strlen($currentNamespaceFqsen) + ) === $currentNamespaceFqsen) { $subPath = substr($entry, strlen($currentNamespaceFqsen)); } $path = substr(str_replace('\\', '/', $subPath), 1); @@ -244,8 +253,10 @@ private function addFunctions() /** @var Param $param */ $param = $params[$argument->getName()]; if ($param !== null) { - $this->addMultiline(':param '.self::escape($param->getType()).' $'.$argument->getName().': '.$param->getDescription(), - true); + $this->addMultiline( + ':param '.self::escape($param->getType()).' $'.$argument->getName().': '.$param->getDescription(), + true + ); } } } diff --git a/src/GenerateDocumentationCommand.php b/src/GenerateDocumentationCommand.php index 988a57a..1d27be2 100755 --- a/src/GenerateDocumentationCommand.php +++ b/src/GenerateDocumentationCommand.php @@ -39,15 +39,39 @@ class GenerateDocumentationCommand extends Command { protected function configure() { - $this->setName('generate')->setDescription('Generate documentation')->setHelp('This command allows you to generate sphinx/rst based documentation from PHPDoc annotations.')->addArgument('target', - InputArgument::REQUIRED, 'Destination for the generated rst files')->addArgument('src', - InputArgument::IS_ARRAY, 'Source directories to parse')->addOption('public-only', 'p', - InputOption::VALUE_NONE)->addOption('show-private', null, - InputOption::VALUE_NONE)->addOption('element-toc', 't', - InputOption::VALUE_NONE)->addOption('repo-github', null, InputOption::VALUE_REQUIRED, - 'Github URL of the projects git repository (requires --repo-base as well)', - false)->addOption('repo-base', null, InputOption::VALUE_REQUIRED, - 'Base path of the project git repository', false); + $this->setName('generate')->setDescription('Generate documentation')->setHelp('This command allows you to generate sphinx/rst based documentation from PHPDoc annotations.')->addArgument( + 'target', + InputArgument::REQUIRED, + 'Destination for the generated rst files' + )->addArgument( + 'src', + InputArgument::IS_ARRAY, + 'Source directories to parse' + )->addOption( + 'public-only', + 'p', + InputOption::VALUE_NONE + )->addOption( + 'show-private', + null, + InputOption::VALUE_NONE + )->addOption( + 'element-toc', + 't', + InputOption::VALUE_NONE + )->addOption( + 'repo-github', + null, + InputOption::VALUE_REQUIRED, + 'Github URL of the projects git repository (requires --repo-base as well)', + false + )->addOption( + 'repo-base', + null, + InputOption::VALUE_REQUIRED, + 'Base path of the project git repository', + false + ); } protected function execute(InputInterface $input, OutputInterface $output)