private parseAndFixFiles ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, IteratorAggregate $files, array $options ) : |
||
$input | Symfony\Component\Console\Input\InputInterface | Input |
$output | Symfony\Component\Console\Output\OutputInterface | Output |
$files | IteratorAggregate | Files |
$options | array | Options |
Результат | self Object |
private function parseAndFixFiles(InputInterface $input, OutputInterface $output, IteratorAggregate $files, array $options)
{
$dryRun = $input->getOption('dry-run');
$verbose = $output->getVerbosity();
$useSorter = $this->createUseSorter($options);
/*
* Each found php file is processed
*/
foreach ($files as $file) {
$data = file_get_contents($file);
$result = $useSorter->sort($data);
if ($result === false || $data === $result) {
continue;
}
if ($verbose >= OutputInterface::VERBOSITY_NORMAL) {
$output->writeln('# ' . $file);
}
if (!$dryRun) {
file_put_contents($file, $result);
}
}
return $this;
}