@@ 27-49 (lines=23) @@ | ||
24 | * |
|
25 | * @author Bernhard Schussek <[email protected]> |
|
26 | */ |
|
27 | class HelpJsonHandler |
|
28 | { |
|
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function handle(Args $args, IO $io, Command $command) |
|
33 | { |
|
34 | $descriptor = new JsonDescriptor(); |
|
35 | $output = new IOOutput($io); |
|
36 | $application = $command->getApplication(); |
|
37 | $applicationAdapter = new ApplicationAdapter($application); |
|
38 | ||
39 | if ($args->isArgumentSet('command')) { |
|
40 | $theCommand = $application->getCommand($args->getArgument('command')); |
|
41 | $commandAdapter = new CommandAdapter($theCommand, $applicationAdapter); |
|
42 | $descriptor->describe($output, $commandAdapter); |
|
43 | } else { |
|
44 | $descriptor->describe($output, $applicationAdapter); |
|
45 | } |
|
46 | ||
47 | return 0; |
|
48 | } |
|
49 | } |
|
50 |
@@ 27-49 (lines=23) @@ | ||
24 | * |
|
25 | * @author Bernhard Schussek <[email protected]> |
|
26 | */ |
|
27 | class HelpXmlHandler |
|
28 | { |
|
29 | /** |
|
30 | * {@inheritdoc} |
|
31 | */ |
|
32 | public function handle(Args $args, IO $io, Command $command) |
|
33 | { |
|
34 | $descriptor = new XmlDescriptor(); |
|
35 | $output = new IOOutput($io); |
|
36 | $application = $command->getApplication(); |
|
37 | $applicationAdapter = new ApplicationAdapter($application); |
|
38 | ||
39 | if ($args->isArgumentSet('command')) { |
|
40 | $theCommand = $application->getCommand($args->getArgument('command')); |
|
41 | $commandAdapter = new CommandAdapter($theCommand, $applicationAdapter); |
|
42 | $descriptor->describe($output, $commandAdapter); |
|
43 | } else { |
|
44 | $descriptor->describe($output, $applicationAdapter); |
|
45 | } |
|
46 | ||
47 | return 0; |
|
48 | } |
|
49 | } |
|
50 |