for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of gpupo/pipe2
*
* (c) Gilmar Pupo <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* For more information, see
* <https://opensource.gpupo.com/pipe2/>.
*/
namespace Gpupo\Pipe2\Documentor;
use Symfony\Component\Console\Command\Command as Core;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Command extends Core
{
protected function configure()
parent::configure();
$this
->setName('documentor')
->setDescription('Generate Markdown Documentation from PhpUnit XML')
->addArgument(
'inputFile',
InputArgument::REQUIRED,
'PhpUnit Xml file path'
)
'outputFile',
'Output file path'
);
}
protected function getParameters(InputInterface $input)
$parameters = [];
foreach (['inputFile', 'outputFile'] as $argument) {
$parameters[$argument] = $input->getArgument($argument);
return $parameters;
protected function execute(InputInterface $input, OutputInterface $output)
$parameters = $this->getParameters($input);
$validator = new InputValidator();
if ($validator->validateInputParameters($parameters)) {
$converter = new Converter($parameters);
$converter
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
$output->writeln('Generated '.$parameters['outputFile']);
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.