|
@@ -22,6 +22,8 @@ use Symfony\Component\Console\Application;
|
|
|
* Base class for all commands.
|
|
|
*
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
class Command
|
|
|
{
|
|
@@ -43,6 +45,8 @@ class Command
|
|
|
* @param string $name The name of the command
|
|
|
*
|
|
|
* @throws \LogicException When the command name is empty
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function __construct($name = null)
|
|
|
{
|
|
@@ -66,6 +70,8 @@ class Command
|
|
|
* Sets the application instance for this command.
|
|
|
*
|
|
|
* @param Application $application An Application instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function setApplication(Application $application = null)
|
|
|
{
|
|
@@ -76,6 +82,8 @@ class Command
|
|
|
* Gets the application instance for this command.
|
|
|
*
|
|
|
* @return Application An Application instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getApplication()
|
|
|
{
|
|
@@ -145,6 +153,8 @@ class Command
|
|
|
*
|
|
|
* @see setCode()
|
|
|
* @see execute()
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function run(InputInterface $input, OutputInterface $output)
|
|
|
{
|
|
@@ -189,6 +199,8 @@ class Command
|
|
|
* @return Command The current instance
|
|
|
*
|
|
|
* @see execute()
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function setCode(\Closure $code)
|
|
|
{
|
|
@@ -222,6 +234,8 @@ class Command
|
|
|
* @param array|Definition $definition An array of argument and option instances or a definition instance
|
|
|
*
|
|
|
* @return Command The current instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function setDefinition($definition)
|
|
|
{
|
|
@@ -240,6 +254,8 @@ class Command
|
|
|
* Gets the InputDefinition attached to this Command.
|
|
|
*
|
|
|
* @return InputDefinition An InputDefinition instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getDefinition()
|
|
|
{
|
|
@@ -255,6 +271,8 @@ class Command
|
|
|
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
|
|
|
*
|
|
|
* @return Command The current instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function addArgument($name, $mode = null, $description = '', $default = null)
|
|
|
{
|
|
@@ -273,6 +291,8 @@ class Command
|
|
|
* @param mixed $default The default value (must be null for InputOption::VALUE_REQUIRED or self::VALUE_NONE)
|
|
|
*
|
|
|
* @return Command The current instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
|
|
|
{
|
|
@@ -294,6 +314,8 @@ class Command
|
|
|
* @return Command The current instance
|
|
|
*
|
|
|
* @throws \InvalidArgumentException When command name given is empty
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function setName($name)
|
|
|
{
|
|
@@ -318,6 +340,8 @@ class Command
|
|
|
* Returns the command namespace.
|
|
|
*
|
|
|
* @return string The command namespace
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getNamespace()
|
|
|
{
|
|
@@ -328,6 +352,8 @@ class Command
|
|
|
* Returns the command name
|
|
|
*
|
|
|
* @return string The command name
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getName()
|
|
|
{
|
|
@@ -338,6 +364,8 @@ class Command
|
|
|
* Returns the fully qualified command name.
|
|
|
*
|
|
|
* @return string The fully qualified command name
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getFullName()
|
|
|
{
|
|
@@ -350,6 +378,8 @@ class Command
|
|
|
* @param string $description The description for the command
|
|
|
*
|
|
|
* @return Command The current instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function setDescription($description)
|
|
|
{
|
|
@@ -362,6 +392,8 @@ class Command
|
|
|
* Returns the description for the command.
|
|
|
*
|
|
|
* @return string The description for the command
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getDescription()
|
|
|
{
|
|
@@ -374,6 +406,8 @@ class Command
|
|
|
* @param string $help The help for the command
|
|
|
*
|
|
|
* @return Command The current instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function setHelp($help)
|
|
|
{
|
|
@@ -386,6 +420,8 @@ class Command
|
|
|
* Returns the help for the command.
|
|
|
*
|
|
|
* @return string The help for the command
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getHelp()
|
|
|
{
|
|
@@ -420,6 +456,8 @@ class Command
|
|
|
* @param array $aliases An array of aliases for the command
|
|
|
*
|
|
|
* @return Command The current instance
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function setAliases($aliases)
|
|
|
{
|
|
@@ -432,6 +470,8 @@ class Command
|
|
|
* Returns the aliases for the command.
|
|
|
*
|
|
|
* @return array An array of aliases for the command
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getAliases()
|
|
|
{
|
|
@@ -460,6 +500,8 @@ class Command
|
|
|
* @return mixed The helper value
|
|
|
*
|
|
|
* @throws \InvalidArgumentException if the helper is not defined
|
|
|
+ *
|
|
|
+ * @api
|
|
|
*/
|
|
|
public function getHelper($name)
|
|
|
{
|