|
@@ -201,7 +201,7 @@ class Application
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Get the helper set associated with the command
|
|
|
|
|
|
+ * Get the helper set associated with the command.
|
|
*
|
|
*
|
|
* @return HelperSet The HelperSet instance associated with this command
|
|
* @return HelperSet The HelperSet instance associated with this command
|
|
*/
|
|
*/
|
|
@@ -396,7 +396,7 @@ class Application
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Returns true if the command exists, false otherwise
|
|
|
|
|
|
+ * Returns true if the command exists, false otherwise.
|
|
*
|
|
*
|
|
* @param string $name The command name or alias
|
|
* @param string $name The command name or alias
|
|
*
|
|
*
|
|
@@ -429,6 +429,8 @@ class Application
|
|
/**
|
|
/**
|
|
* Finds a registered namespace by a name or an abbreviation.
|
|
* Finds a registered namespace by a name or an abbreviation.
|
|
*
|
|
*
|
|
|
|
+ * @param string $namespace A namespace or abbreviation to search for
|
|
|
|
+ *
|
|
* @return string A registered namespace
|
|
* @return string A registered namespace
|
|
*
|
|
*
|
|
* @throws \InvalidArgumentException When namespace is incorrect or ambiguous
|
|
* @throws \InvalidArgumentException When namespace is incorrect or ambiguous
|
|
@@ -715,11 +717,25 @@ class Application
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Gets the name of the command based on input.
|
|
|
|
+ *
|
|
|
|
+ * @param InputInterface $input The input interface
|
|
|
|
+ *
|
|
|
|
+ * @return string The command name
|
|
|
|
+ */
|
|
protected function getCommandName(InputInterface $input)
|
|
protected function getCommandName(InputInterface $input)
|
|
{
|
|
{
|
|
return $input->getFirstArgument('command');
|
|
return $input->getFirstArgument('command');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Sorts commands in alphabetical order.
|
|
|
|
+ *
|
|
|
|
+ * @param array $commands An associative array of commands to sort
|
|
|
|
+ *
|
|
|
|
+ * @return array A sorted array of commands
|
|
|
|
+ */
|
|
protected function sortCommands($commands)
|
|
protected function sortCommands($commands)
|
|
{
|
|
{
|
|
$namespacedCommands = array();
|
|
$namespacedCommands = array();
|
|
@@ -741,6 +757,13 @@ class Application
|
|
return $namespacedCommands;
|
|
return $namespacedCommands;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Returns abbreviated suggestions in string format.
|
|
|
|
+ *
|
|
|
|
+ * @param array $abbrevs Abbreviated suggestions to convert
|
|
|
|
+ *
|
|
|
|
+ * @return string A formatted string of abbreviated suggestions
|
|
|
|
+ */
|
|
protected function getAbbreviationSuggestions($abbrevs)
|
|
protected function getAbbreviationSuggestions($abbrevs)
|
|
{
|
|
{
|
|
return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
|
|
return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
|