Permalink
Browse files

[help] Validate examples at TextDescriptor class. (#328)

  • Loading branch information...
jmolivas committed Mar 6, 2018
1 parent 1e6afe1 commit da4dac86ae46978741280284d96753686f794d86
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/Descriptor/TextDescriptor.php
@@ -157,12 +157,14 @@ protected function describeCommand(Command $command, array $options = [])
(strpos($command->getName(), ':')?:0)
);
$commandData = $command->getApplication()->getData();
$commands = $commandData['commands'][$namespace];
$examples = [];
foreach ($commands as $item) {
if ($item['name'] == $command->getName()) {
$examples = $item['examples'];
break;
if (array_key_exists($namespace, $commandData['commands'])) {
$commands = $commandData['commands'][$namespace];
foreach ($commands as $item) {
if ($item['name'] == $command->getName()) {
$examples = $item['examples'];
break;
}
}
}

0 comments on commit da4dac8

Please sign in to comment.