Skip to content

Commit

Permalink
[help] Validate examples at TextDescriptor class. (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Mar 6, 2018
1 parent 1e6afe1 commit da4dac8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Descriptor/TextDescriptor.php
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit da4dac8

Please sign in to comment.