class ServerStatusCommand extends Command
Shows the status of a process that is running PHP's built-in web server in the background.
static protected | $defaultName |
static string|null | getDefaultName() | from Command |
__construct(string $name = null) | from Command | |
ignoreValidationErrors() Ignores validation errors. | from Command | |
setApplication(Application $application = null) | from Command | |
setHelperSet(HelperSet $helperSet) | from Command | |
HelperSet | getHelperSet() Gets the helper set. | from Command |
Application | getApplication() Gets the application instance for this command. | from Command |
bool | isEnabled() Checks whether the command is enabled or not in the current environment. | from Command |
configure() Configures the current command. | ||
int|null | execute(InputInterface $input, OutputInterface $output) Executes the current command. | |
interact(InputInterface $input, OutputInterface $output) Interacts with the user. | from Command | |
initialize(InputInterface $input, OutputInterface $output) Initializes the command after the input has been bound and before the input is validated. | from Command | |
int | run(InputInterface $input, OutputInterface $output) Runs the command. | from Command |
$this | setCode(callable $code) Sets the code to execute when running this command. | from Command |
mergeApplicationDefinition(bool $mergeArgs = true) Merges the application definition with the command definition. | from Command | |
$this | setDefinition(array|InputDefinition $definition) Sets an array of argument and option instances. | from Command |
InputDefinition | getDefinition() Gets the InputDefinition attached to this Command. | from Command |
InputDefinition | getNativeDefinition() Gets the InputDefinition to be used to create representations of this Command. | from Command |
$this | addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from Command |
$this | addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from Command |
$this | setName(string $name) Sets the name of the command. | from Command |
$this | setProcessTitle(string $title) Sets the process title of the command. | from Command |
string | getName() Returns the command name. | from Command |
Command | setHidden(bool $hidden) | from Command |
bool | isHidden() | from Command |
$this | setDescription(string $description) Sets the description for the command. | from Command |
string | getDescription() Returns the description for the command. | from Command |
$this | setHelp(string $help) Sets the help for the command. | from Command |
string | getHelp() Returns the help for the command. | from Command |
string | getProcessedHelp() Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically. | from Command |
$this | setAliases(string[] $aliases) Sets the aliases for the command. | from Command |
array | getAliases() Returns the aliases for the command. | from Command |
string | getSynopsis(bool $short = false) Returns the synopsis for the command. | from Command |
$this | addUsage(string $usage) Add a command usage example. | from Command |
array | getUsages() Returns alternative usages of the command. | from Command |
mixed | getHelper(string $name) Gets a helper instance by name. | from Command |
string|null | The default command name or null when no default name is set |
string | $name | The name of the command; passing null means it must be set in configure() |
LogicException | When the command name is empty |
Ignores validation errors.
This is mainly useful for the help command.
Application | $application |
HelperSet | $helperSet |
Gets the helper set.
HelperSet | A HelperSet instance |
Gets the application instance for this command.
Application | An Application instance |
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not run properly under the current conditions.
bool |
Configures the current command.
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
InputInterface | $input | |
OutputInterface | $output |
int|null | null or 0 if everything went fine, or an error code |
LogicException | When this abstract method is not implemented |
Interacts with the user.
This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.
InputInterface | $input | |
OutputInterface | $output |
Initializes the command after the input has been bound and before the input is validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
InputInterface | $input | |
OutputInterface | $output |
InputInterface::bind | |
InputInterface::validate |
Runs the command.
The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.
InputInterface | $input | |
OutputInterface | $output |
int | The command exit code |
Exception | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. |
setCode() | |
execute() |
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
callable | $code | A callable(InputInterface $input, OutputInterface $output) |
$this |
InvalidArgumentException |
execute() |
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments |
Sets an array of argument and option instances.
array|InputDefinition | $definition | An array of argument and option instances or a definition instance |
$this |
Gets the InputDefinition attached to this Command.
InputDefinition | An InputDefinition instance |
Gets the InputDefinition to be used to create representations of this Command.
Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
InputDefinition | An InputDefinition instance |
Adds an argument.
string | $name | The argument name |
int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL |
string | $description | A description text |
string|string[]|null | $default | The default value (for self::OPTIONAL mode only) |
$this |
InvalidArgumentException | When argument mode is not valid |
Adds an option.
string | $name | The option name |
string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
int|null | $mode | The option mode: One of the VALUE_* constants |
string | $description | A description text |
string|string[]|bool|null | $default | The default value (must be null for self::VALUE_NONE) |
$this |
InvalidArgumentException | If option mode is invalid or incompatible |
Sets the name of the command.
This method can set both the namespace and the name if you separate them by a colon (:)
$command->setName('foo:bar');
string | $name | The command name |
$this |
InvalidArgumentException | When the name is invalid |
Sets the process title of the command.
This feature should be used only when creating a long process command, like a daemon.
PHP 5.5+ or the proctitle PECL library is required
string | $title | The process title |
$this |
Returns the command name.
string | The command name |
bool | $hidden | Whether or not the command should be hidden from the list of commands |
Command | The current instance |
bool | whether the command should be publicly shown or not |
Sets the description for the command.
string | $description | The description for the command |
$this |
Returns the description for the command.
string | The description for the command |
Sets the help for the command.
string | $help | The help for the command |
$this |
Returns the help for the command.
string | The help for the command |
Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.
string | The processed help for the command |
Sets the aliases for the command.
string[] | $aliases | An array of aliases for the command |
$this |
InvalidArgumentException | When an alias is invalid |
Returns the aliases for the command.
array | An array of aliases for the command |
Returns the synopsis for the command.
bool | $short | Whether to show the short version of the synopsis (with options folded) or not |
string | The synopsis |
Add a command usage example.
string | $usage | The usage, it'll be prefixed with the command name |
$this |
Returns alternative usages of the command.
array |
Gets a helper instance by name.
string | $name | The helper name |
mixed | The helper value |
LogicException | if no HelperSet is defined |
InvalidArgumentException | if the helper is not defined |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.html