Laravel version update
Laravel version update
This commit is contained in:
@@ -64,16 +64,28 @@ class JsonDescriptor extends Descriptor
|
||||
protected function describeApplication(Application $application, array $options = array())
|
||||
{
|
||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
$description = new ApplicationDescription($application, $describedNamespace, true);
|
||||
$commands = array();
|
||||
|
||||
foreach ($description->getCommands() as $command) {
|
||||
$commands[] = $this->getCommandData($command);
|
||||
}
|
||||
|
||||
$data = $describedNamespace
|
||||
? array('commands' => $commands, 'namespace' => $describedNamespace)
|
||||
: array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
|
||||
$data = array();
|
||||
if ('UNKNOWN' !== $application->getName()) {
|
||||
$data['application']['name'] = $application->getName();
|
||||
if ('UNKNOWN' !== $application->getVersion()) {
|
||||
$data['application']['version'] = $application->getVersion();
|
||||
}
|
||||
}
|
||||
|
||||
$data['commands'] = $commands;
|
||||
|
||||
if ($describedNamespace) {
|
||||
$data['namespace'] = $describedNamespace;
|
||||
} else {
|
||||
$data['namespaces'] = array_values($description->getNamespaces());
|
||||
}
|
||||
|
||||
$this->writeData($data, $options);
|
||||
}
|
||||
@@ -81,9 +93,6 @@ class JsonDescriptor extends Descriptor
|
||||
/**
|
||||
* Writes data as json.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $options
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
private function writeData(array $data, array $options)
|
||||
@@ -92,8 +101,6 @@ class JsonDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputArgument $argument
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getInputArgumentData(InputArgument $argument)
|
||||
@@ -103,31 +110,27 @@ class JsonDescriptor extends Descriptor
|
||||
'is_required' => $argument->isRequired(),
|
||||
'is_array' => $argument->isArray(),
|
||||
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
|
||||
'default' => $argument->getDefault(),
|
||||
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputOption $option
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getInputOptionData(InputOption $option)
|
||||
{
|
||||
return array(
|
||||
'name' => '--'.$option->getName(),
|
||||
'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
|
||||
'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
|
||||
'accept_value' => $option->acceptValue(),
|
||||
'is_value_required' => $option->isValueRequired(),
|
||||
'is_multiple' => $option->isArray(),
|
||||
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
|
||||
'default' => $option->getDefault(),
|
||||
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputDefinition $definition
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getInputDefinitionData(InputDefinition $definition)
|
||||
@@ -146,8 +149,6 @@ class JsonDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Command $command
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getCommandData(Command $command)
|
||||
@@ -161,6 +162,7 @@ class JsonDescriptor extends Descriptor
|
||||
'description' => $command->getDescription(),
|
||||
'help' => $command->getProcessedHelp(),
|
||||
'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
|
||||
'hidden' => $command->isHidden(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user