Commit 32ba6c2c authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

CS.

parent 9561b621
<?php declare(strict_types=1); <?php declare(strict_types=1);
/** /*
* Copyright (C) 2019 IRSTEA * This file is part of "irstea/plantuml-bundle".
* All rights reserved. *
* 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.
*
* 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.
* *
* @copyright 2019 IRSTEA * You should have received a copy of the GNU General Public License and the GNU
* @author guillaume.perreal * Lesser General Public License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/ */
namespace Irstea\PlantUmlBundle\Command; namespace Irstea\PlantUmlBundle\Command;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* Class ListCommand * Class ListCommand.
*/ */
class ListCommand extends Command class ListCommand extends Command
{ {
...@@ -32,6 +41,7 @@ class ListCommand extends Command ...@@ -32,6 +41,7 @@ class ListCommand extends Command
/** /**
* ListCommand constructor. * ListCommand constructor.
*
* @param string[] $graphNames * @param string[] $graphNames
*/ */
public function __construct(array $graphNames) public function __construct(array $graphNames)
...@@ -41,7 +51,7 @@ class ListCommand extends Command ...@@ -41,7 +51,7 @@ class ListCommand extends Command
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function configure() protected function configure()
{ {
...@@ -51,7 +61,7 @@ class ListCommand extends Command ...@@ -51,7 +61,7 @@ class ListCommand extends Command
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
......
...@@ -78,6 +78,7 @@ class RenderCommand extends Command ...@@ -78,6 +78,7 @@ class RenderCommand extends Command
/** /**
* RenderCommand constructor. * RenderCommand constructor.
*
* @param ContainerInterface $container * @param ContainerInterface $container
* @param array $graphNames * @param array $graphNames
* @param string $defaultFormat * @param string $defaultFormat
...@@ -99,7 +100,7 @@ class RenderCommand extends Command ...@@ -99,7 +100,7 @@ class RenderCommand extends Command
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function configure(): void protected function configure(): void
{ {
...@@ -112,7 +113,7 @@ class RenderCommand extends Command ...@@ -112,7 +113,7 @@ class RenderCommand extends Command
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
...@@ -176,11 +177,13 @@ class RenderCommand extends Command ...@@ -176,11 +177,13 @@ class RenderCommand extends Command
/** /**
* @param $target * @param $target
* @param $format * @param $format
*
* @return array * @return array
*/ */
private function startProcess($target, $format): 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->findExecutable($this->javaBinary),
$this->plantUmlJar, $this->plantUmlJar,
$this->findExecutable($this->dotBinary), $this->findExecutable($this->dotBinary),
...@@ -207,6 +210,7 @@ class RenderCommand extends Command ...@@ -207,6 +210,7 @@ class RenderCommand extends Command
/** /**
* @param string $nameOrPath * @param string $nameOrPath
*
* @return string * @return string
*/ */
private function findExecutable(string $nameOrPath): string private function findExecutable(string $nameOrPath): string
...@@ -219,6 +223,7 @@ class RenderCommand extends Command ...@@ -219,6 +223,7 @@ class RenderCommand extends Command
if ($path === null) { if ($path === null) {
throw new \RuntimeException("cannot find executable: $nameOrPath"); throw new \RuntimeException("cannot find executable: $nameOrPath");
} }
return $path; return $path;
} }
} }
...@@ -44,6 +44,7 @@ class ClassFinder implements FinderInterface ...@@ -44,6 +44,7 @@ class ClassFinder implements FinderInterface
/** /**
* ClassFinder constructor. * ClassFinder constructor.
*
* @param string[] $directories * @param string[] $directories
*/ */
public function __construct(array $directories) public function __construct(array $directories)
......
...@@ -40,6 +40,7 @@ abstract class AbstractListFilter implements ClassFilterInterface ...@@ -40,6 +40,7 @@ abstract class AbstractListFilter implements ClassFilterInterface
/** /**
* AbstractListFilter constructor. * AbstractListFilter constructor.
*
* @param array $allowed * @param array $allowed
* @param bool $notFound * @param bool $notFound
*/ */
...@@ -51,6 +52,7 @@ abstract class AbstractListFilter implements ClassFilterInterface ...@@ -51,6 +52,7 @@ abstract class AbstractListFilter implements ClassFilterInterface
/** /**
* @param ReflectionClass $class * @param ReflectionClass $class
*
* @return bool * @return bool
*/ */
public function accept(ReflectionClass $class) public function accept(ReflectionClass $class)
......
...@@ -33,7 +33,7 @@ class ClassFilter extends AbstractListFilter ...@@ -33,7 +33,7 @@ class ClassFilter extends AbstractListFilter
public const CONF_TYPE = 'classes'; public const CONF_TYPE = 'classes';
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function extract(ReflectionClass $class): string protected function extract(ReflectionClass $class): string
{ {
...@@ -41,7 +41,7 @@ class ClassFilter extends AbstractListFilter ...@@ -41,7 +41,7 @@ class ClassFilter extends AbstractListFilter
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function matches($tested, $reference): bool protected function matches($tested, $reference): bool
{ {
...@@ -49,7 +49,7 @@ class ClassFilter extends AbstractListFilter ...@@ -49,7 +49,7 @@ class ClassFilter extends AbstractListFilter
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function normalize($className): string protected function normalize($className): string
{ {
......
...@@ -34,7 +34,7 @@ class DirectoryFilter extends AbstractListFilter ...@@ -34,7 +34,7 @@ class DirectoryFilter extends AbstractListFilter
public const CONF_TYPE = 'directories'; public const CONF_TYPE = 'directories';
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function extract(ReflectionClass $class): string protected function extract(ReflectionClass $class): string
{ {
...@@ -42,12 +42,14 @@ class DirectoryFilter extends AbstractListFilter ...@@ -42,12 +42,14 @@ class DirectoryFilter extends AbstractListFilter
if ($filename === false) { if ($filename === false) {
return ''; return '';
} }
return Path::getDirectory($filename); return Path::getDirectory($filename);
} }
/** /**
* @param mixed $tested * @param mixed $tested
* @param mixed $reference * @param mixed $reference
*
* @return bool * @return bool
*/ */
protected function matches($tested, $reference): bool protected function matches($tested, $reference): bool
...@@ -57,6 +59,7 @@ class DirectoryFilter extends AbstractListFilter ...@@ -57,6 +59,7 @@ class DirectoryFilter extends AbstractListFilter
/** /**
* @param string $path * @param string $path
*
* @return string * @return string
*/ */
protected function normalize($path): string protected function normalize($path): string
......
...@@ -30,7 +30,7 @@ class NamespaceFilter extends AbstractListFilter ...@@ -30,7 +30,7 @@ class NamespaceFilter extends AbstractListFilter
public const CONF_TYPE = 'namespaces'; public const CONF_TYPE = 'namespaces';
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function extract(ReflectionClass $class): string protected function extract(ReflectionClass $class): string
{ {
...@@ -38,7 +38,7 @@ class NamespaceFilter extends AbstractListFilter ...@@ -38,7 +38,7 @@ class NamespaceFilter extends AbstractListFilter
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function matches($tested, $reference): bool protected function matches($tested, $reference): bool
{ {
...@@ -46,7 +46,7 @@ class NamespaceFilter extends AbstractListFilter ...@@ -46,7 +46,7 @@ class NamespaceFilter extends AbstractListFilter
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function normalize($namespace): string protected function normalize($namespace): string
{ {
......
...@@ -40,6 +40,7 @@ class Graph implements GraphInterface ...@@ -40,6 +40,7 @@ class Graph implements GraphInterface
/** /**
* Graph constructor. * Graph constructor.
*
* @param ClassVisitorInterface $visitor * @param ClassVisitorInterface $visitor
* @param FinderInterface $finder * @param FinderInterface $finder
*/ */
...@@ -49,9 +50,6 @@ class Graph implements GraphInterface ...@@ -49,9 +50,6 @@ class Graph implements GraphInterface
$this->finder = $finder; $this->finder = $finder;
} }
/**
*
*/
public function visitAll(): void public function visitAll(): void
{ {
foreach ($this->finder->getIterator() as $class) { foreach ($this->finder->getIterator() as $class) {
...@@ -61,6 +59,7 @@ class Graph implements GraphInterface ...@@ -61,6 +59,7 @@ class Graph implements GraphInterface
/** /**
* @param WriterInterface $writer * @param WriterInterface $writer
*
* @return $this * @return $this
*/ */
public function writeTo(WriterInterface $writer): self public function writeTo(WriterInterface $writer): self
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment