diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ClassMapDumperCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ClassMapDumperCommand.php new file mode 100644 index 0000000000000..6590335fe04c9 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ClassMapDumperCommand.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Command; + +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\ClassLoader\ClassMapGenerator; + +/** + * ClassMapDumperCommand. + * + * @author Luis Cordova + */ +class ClassMapDumperCommand extends ContainerAwareCommand +{ + /** + * @see Command + */ + protected function configure() + { + $this + ->setDefinition(array( + new InputArgument('dir', InputArgument::REQUIRED, 'Directories or a single path to search in.'), + new InputOption('file', null, InputOption::VALUE_REQUIRED, 'The name of the class map file.', 'classmap.php'), + )) + ->setName('generate:class-map') + ->setDescription('Generates class map file') + ->setHelp(<<generate:class-map generates class map file. + + generate:class-map dir file +EOF + ) + ; + } + + /** + * @see Command + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($input->getArgument('dir')) { + $dir = $input->getArgument('dir'); + } + + if ($input->getOption('file')) { + $file = $input->getOption('file'); + } + + ClassMapGenerator::dump($dir, $file); + + $output->writeln('Class map has been generated.'); + } +}