/**
* Execute command
*
* @param InputInterface $input Input
* @param OutputInterface $output Output
*
* @return int|null|void
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$path = $input->getArgument('path');
/**
* We load the options to work with
*/
$options = $this->getUsableConfig($input);
/**
* Building the real directory or file to work in
*/
$filesystem = new Filesystem();
if (!$filesystem->isAbsolutePath($path)) {
$path = getcwd() . DIRECTORY_SEPARATOR . $path;
}
if (!is_file($path) && !is_dir($path)) {
throw new Exception('Directory or file "' . $path . '" does not exist');
}
/**
* Print dry-run message if needed
*/
$this->printDryRunMessage($input, $output, $path);
/**
* Print all configuration block if verbose level allows it
*/
$this->printConfigUsed($output, $options);
$fileFinder = new FileFinder();
$files = $fileFinder->findPHPFilesByPath($path);
/**
* Parse and fix all found files
*/
$this->parseAndFixFiles($input, $output, $files, $options);
}