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

CS.

parent 9561b621
<?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)
{
......
......@@ -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;
}
}
......@@ -44,6 +44,7 @@ class ClassFinder implements FinderInterface
/**
* ClassFinder constructor.
*
* @param string[] $directories
*/
public function __construct(array $directories)
......
......@@ -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)
......
......@@ -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
{
......
......@@ -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
......
......@@ -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
{
......
......@@ -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
......
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