/** * Execute the command. * * @param InputInterface $input * @param OutputInterface $output * * @return int|null */ protected function execute(InputInterface $input, OutputInterface $output) { $headerCommand = new HeaderCommand(); $sortCommand = new UseSortCommand(); $filesystem = new Filesystem(); foreach (RootDirectories::getEnforceable() as $directory) { if ($filesystem->exists($directory) && is_dir($directory)) { $formatInput = ['path' => $directory]; if ($input->getOption('dry-run')) { $formatInput['--dry-run'] = true; } $output->writeln('<comment>' . $directory . '</comment>'); $headerCommand->run(new ArrayInput($formatInput), $output); $sortCommand->run(new ArrayInput($formatInput), $output); } } return 0; }