Skip to content

Commit

Permalink
[7-5] debug:routerコマンドのソース
Browse files Browse the repository at this point in the history
  • Loading branch information
hidenorigoto committed Dec 28, 2015
1 parent c78a42c commit 3a001ab
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docs/lists/ch07/07-05.txt
@@ -0,0 +1,42 @@
class RouterDebugCommand extends ContainerAwareCommand
{
...
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('debug:router')
->setAliases(array(
'router:debug',
))
->setDefinition(array(
new InputArgument('name', InputArgument::OPTIONAL, 'A route name'),
new InputOption('show-controllers', null, InputOption::VALUE_NONE, 'Show assigned controllers in overview'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw route(s)'),
))
->setDescription('Displays current routes for an application')
->setHelp(<<<EOF
The <info>%command.name%</info> displays the configured routes:

<info>php %command.full_name%</info>

EOF
)
;
}

/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException When route does not exist
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
...
$name = $input->getArgument('name');
...
}
...

0 comments on commit 3a001ab

Please sign in to comment.