diff --git a/src/Command/ListCommand.php b/src/Command/ListCommand.php index c1c8d55463088c31ea085561d514fe7d75a496dc..7fc71a2c883756fddc765a0109d21edda10f0844 100644 --- a/src/Command/ListCommand.php +++ b/src/Command/ListCommand.php @@ -1,22 +1,31 @@ <?php declare(strict_types=1); -/** - * Copyright (C) 2019 IRSTEA - * All rights reserved. +/* + * This file is part of "irstea/plantuml-bundle". + * + * Copyright (C) 2016-2019 IRSTEA + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) any + * later version. * - * @copyright 2019 IRSTEA - * @author guillaume.perreal + * This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License and the GNU + * Lesser General Public License along with this program. If not, see + * <https://www.gnu.org/licenses/>. */ - namespace Irstea\PlantUmlBundle\Command; - use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; /** - * Class ListCommand + * Class ListCommand. */ class ListCommand extends Command { @@ -32,6 +41,7 @@ class ListCommand extends Command /** * ListCommand constructor. + * * @param string[] $graphNames */ public function __construct(array $graphNames) @@ -41,7 +51,7 @@ class ListCommand extends Command } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configure() { @@ -51,7 +61,7 @@ class ListCommand extends Command } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/src/Command/RenderCommand.php b/src/Command/RenderCommand.php index e845b587bcadd72fe2821a3cc6d7cdd52dc497c8..bc35f1cde72f3382fcdc5fb4611d291570a0f155 100644 --- a/src/Command/RenderCommand.php +++ b/src/Command/RenderCommand.php @@ -78,13 +78,14 @@ class RenderCommand extends Command /** * RenderCommand constructor. + * * @param ContainerInterface $container - * @param array $graphNames - * @param string $defaultFormat - * @param string $defaultOutput - * @param string $javaBinary - * @param string $plantUmlJar - * @param string $dotBinary + * @param array $graphNames + * @param string $defaultFormat + * @param string $defaultOutput + * @param string $javaBinary + * @param string $plantUmlJar + * @param string $dotBinary */ public function __construct(ContainerInterface $container, array $graphNames, string $defaultFormat, string $defaultOutput, string $javaBinary, string $plantUmlJar, string $dotBinary) { @@ -99,7 +100,7 @@ class RenderCommand extends Command } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configure(): void { @@ -112,7 +113,7 @@ class RenderCommand extends Command } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -176,11 +177,13 @@ class RenderCommand extends Command /** * @param $target * @param $format + * * @return array */ private function startProcess($target, $format): array { - $cmd = sprintf('%s -jar %s -graphvizdot %s -pipe -t%s', + $cmd = sprintf( + '%s -jar %s -graphvizdot %s -pipe -t%s', $this->findExecutable($this->javaBinary), $this->plantUmlJar, $this->findExecutable($this->dotBinary), @@ -207,6 +210,7 @@ class RenderCommand extends Command /** * @param string $nameOrPath + * * @return string */ private function findExecutable(string $nameOrPath): string @@ -219,6 +223,7 @@ class RenderCommand extends Command if ($path === null) { throw new \RuntimeException("cannot find executable: $nameOrPath"); } + return $path; } } diff --git a/src/Finder/ClassFinder.php b/src/Finder/ClassFinder.php index 62c32e2cae7bfdf2413257670f6cd56f46f9c3b6..a0b80f08da4b1d244d9dfc63ca4c4ed234684486 100644 --- a/src/Finder/ClassFinder.php +++ b/src/Finder/ClassFinder.php @@ -44,6 +44,7 @@ class ClassFinder implements FinderInterface /** * ClassFinder constructor. + * * @param string[] $directories */ public function __construct(array $directories) diff --git a/src/Model/Filter/AbstractListFilter.php b/src/Model/Filter/AbstractListFilter.php index 296d7cd8a5cbb021790dc480ec6bc79a840485f6..27fb001e54705bbc237059f83a7932ab966d11b3 100644 --- a/src/Model/Filter/AbstractListFilter.php +++ b/src/Model/Filter/AbstractListFilter.php @@ -40,8 +40,9 @@ abstract class AbstractListFilter implements ClassFilterInterface /** * AbstractListFilter constructor. + * * @param array $allowed - * @param bool $notFound + * @param bool $notFound */ public function __construct(array $allowed, $notFound = false) { @@ -51,6 +52,7 @@ abstract class AbstractListFilter implements ClassFilterInterface /** * @param ReflectionClass $class + * * @return bool */ public function accept(ReflectionClass $class) diff --git a/src/Model/Filter/ClassFilter.php b/src/Model/Filter/ClassFilter.php index 570da3cb1cf1217e835ef86cfd506f52c93a73e0..83a052c7f7261cb1ca65e3c806accbe76627c448 100644 --- a/src/Model/Filter/ClassFilter.php +++ b/src/Model/Filter/ClassFilter.php @@ -33,7 +33,7 @@ class ClassFilter extends AbstractListFilter public const CONF_TYPE = 'classes'; /** - * {@inheritDoc} + * {@inheritdoc} */ protected function extract(ReflectionClass $class): string { @@ -41,7 +41,7 @@ class ClassFilter extends AbstractListFilter } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function matches($tested, $reference): bool { @@ -49,7 +49,7 @@ class ClassFilter extends AbstractListFilter } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function normalize($className): string { diff --git a/src/Model/Filter/DirectoryFilter.php b/src/Model/Filter/DirectoryFilter.php index 2f5df2187ce65ca2cd6bed80f8b83a234f50e720..9467170dca89b9398e438f3acfdd5f0554c82473 100644 --- a/src/Model/Filter/DirectoryFilter.php +++ b/src/Model/Filter/DirectoryFilter.php @@ -34,7 +34,7 @@ class DirectoryFilter extends AbstractListFilter public const CONF_TYPE = 'directories'; /** - * {@inheritDoc} + * {@inheritdoc} */ protected function extract(ReflectionClass $class): string { @@ -42,12 +42,14 @@ class DirectoryFilter extends AbstractListFilter if ($filename === false) { return ''; } + return Path::getDirectory($filename); } /** * @param mixed $tested * @param mixed $reference + * * @return bool */ protected function matches($tested, $reference): bool @@ -57,6 +59,7 @@ class DirectoryFilter extends AbstractListFilter /** * @param string $path + * * @return string */ protected function normalize($path): string diff --git a/src/Model/Filter/NamespaceFilter.php b/src/Model/Filter/NamespaceFilter.php index 4e7ccdc66705fddfbd23b9272a26f6b1f96f1801..4d4ddd88e210744733e78ef71c58c24bba4753dd 100644 --- a/src/Model/Filter/NamespaceFilter.php +++ b/src/Model/Filter/NamespaceFilter.php @@ -30,7 +30,7 @@ class NamespaceFilter extends AbstractListFilter public const CONF_TYPE = 'namespaces'; /** - * {@inheritDoc} + * {@inheritdoc} */ protected function extract(ReflectionClass $class): string { @@ -38,7 +38,7 @@ class NamespaceFilter extends AbstractListFilter } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function matches($tested, $reference): bool { @@ -46,7 +46,7 @@ class NamespaceFilter extends AbstractListFilter } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function normalize($namespace): string { diff --git a/src/Model/Graph.php b/src/Model/Graph.php index 119696a03a85c2b8e587f85491a78e19475357ec..313f0f61c57a964d8c5e11dcfa270718e41f6163 100644 --- a/src/Model/Graph.php +++ b/src/Model/Graph.php @@ -40,8 +40,9 @@ class Graph implements GraphInterface /** * Graph constructor. + * * @param ClassVisitorInterface $visitor - * @param FinderInterface $finder + * @param FinderInterface $finder */ public function __construct(ClassVisitorInterface $visitor, FinderInterface $finder) { @@ -49,9 +50,6 @@ class Graph implements GraphInterface $this->finder = $finder; } - /** - * - */ public function visitAll(): void { foreach ($this->finder->getIterator() as $class) { @@ -61,6 +59,7 @@ class Graph implements GraphInterface /** * @param WriterInterface $writer + * * @return $this */ public function writeTo(WriterInterface $writer): self