Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Feature/class map generator command [#2407, #2471] #3394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* 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 <[email protected]>
*/
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(<<<EOF
The <info>generate:class-map</info> generates class map file.

<info>generate:class-map dir file</info>
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.');
}
}