com\setasign\SetaSite\Cli

CreateUserCommand Base class for all commands.

File: /SetaSite/src/Cli/CreateUserCommand.php

Class hierarchy

Implements

  • \Symfony\Component\Console\Command\SignalableCommandInterface

Summary

Constants

FAILURE

public const \Symfony\Component\Console\Command\Command::FAILURE = 1

INVALID

public const \Symfony\Component\Console\Command\Command::INVALID = 2

SUCCESS

public const \Symfony\Component\Console\Command\Command::SUCCESS = 0

Properties

$setasite


Methods

__construct()

public \Symfony\Component\Console\Command\Command::__construct (
?string $name = null,
?callable $code = null
)
Parameters
$name: ?string

The name of the command; passing null means it must be set in configure()

$code: ?callable
 
Exceptions

Throws \Symfony\Component\Console\Exception\LogicException When the command name is empty

addArgument()

public \Symfony\Component\Console\Command\Command::addArgument (
string $name,
?int $mode = null,
array|callable(
\Symfony\Component\Console\Completion\CompletionInput , \Symfony\Component\Console\Completion\CompletionSuggestions
): \Symfony\Component\Console\Command\list<string|\Symfony\Component\Console\Completion\Suggestion>
$description = ''
,
mixed $default = null,
array|\Closure $suggestedValues = array ( )
): static

Adds an argument.

Parameters
$name: string

The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL

$mode: ?int

The default value (for InputArgument::OPTIONAL mode only)

$description: array|callable(
\Symfony\Component\Console\Completion\CompletionInput , \Symfony\Component\Console\Completion\CompletionSuggestions
): \Symfony\Component\Console\Command\list<string|\Symfony\Component\Console\Completion\Suggestion>

The values used for input completion

$default: mixed
 
$suggestedValues: array|\Closure
 
Exceptions

Throws \Symfony\Component\Console\Exception\InvalidArgumentException When argument mode is not valid

addOption()

public \Symfony\Component\Console\Command\Command::addOption (
string $name,
string|array|null $shortcut = null,
?int $mode = null,
array|callable(
\Symfony\Component\Console\Completion\CompletionInput , \Symfony\Component\Console\Completion\CompletionSuggestions
): \Symfony\Component\Console\Command\list<string|\Symfony\Component\Console\Completion\Suggestion>
$description = ''
,
mixed $default = null,
array|\Closure $suggestedValues = array ( )
): static

Adds an option.

Parameters
$name: string

The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts

$shortcut: string|array|null

The option mode: One of the InputOption::VALUE_* constants

$mode: ?int

The default value (must be null for InputOption::VALUE_NONE)

$description: array|callable(
\Symfony\Component\Console\Completion\CompletionInput , \Symfony\Component\Console\Completion\CompletionSuggestions
): \Symfony\Component\Console\Command\list<string|\Symfony\Component\Console\Completion\Suggestion>

The values used for input completion

$default: mixed
 
$suggestedValues: array|\Closure
 
Exceptions

Throws \Symfony\Component\Console\Exception\InvalidArgumentException If option mode is invalid or incompatible

addUsage()

public \Symfony\Component\Console\Command\Command::addUsage (
string $usage
): static

Add a command usage example, it'll be prefixed with the command name.

Parameters
$usage: string
 

complete()

public \Symfony\Component\Console\Command\Command::complete (
\Symfony\Component\Console\Completion\CompletionInput $input,
\Symfony\Component\Console\Completion\CompletionSuggestions $suggestions
): void

Supplies suggestions when resolving possible completion options for input (e.g. option or argument).

Parameters
$input: \Symfony\Component\Console\Completion\CompletionInput
 
$suggestions: \Symfony\Component\Console\Completion\CompletionSuggestions
 

configure()

protected CreateUserCommand::configure (
void
): void

Configures the current command.

execute()

protected CreateUserCommand::execute (
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
): int

Executes the current command.

Parameters
$input: \Symfony\Component\Console\Input\InputInterface
 
$output: \Symfony\Component\Console\Output\OutputInterface
 
Return Values

0 if everything went fine, or an exit code

Exceptions

Throws \Symfony\Component\Console\Exception\LogicException When this abstract method is not implemented

See
  • \Symfony\Component\Console\Command\Command::setCode()

getAliases()

public \Symfony\Component\Console\Command\Command::getAliases (
void
): array

Returns the aliases for the command.

getApplication()

public \Symfony\Component\Console\Command\Command::getApplication (
void
): ?\Symfony\Component\Console\Application

Gets the application instance for this command.

getCode()

public \Symfony\Component\Console\Command\Command::getCode (
void
): ?callable

Gets the code that is executed by the command.

Return Values

null if the code has not been set with setCode()

getCommandAttribute()

private \Symfony\Component\Console\Command\Command::getCommandAttribute (
?callable $code
): ?\Symfony\Component\Console\Attribute\AsCommand
Parameters
$code: ?callable
 

getDefinition()

public \Symfony\Component\Console\Command\Command::getDefinition (
void
): \Symfony\Component\Console\Input\InputDefinition

Gets the InputDefinition attached to this Command.

getDescription()

public \Symfony\Component\Console\Command\Command::getDescription (
void
): string

Returns the description for the command.

getHelp()

public \Symfony\Component\Console\Command\Command::getHelp (
void
): string

Returns the help for the command.

getHelper()

public \Symfony\Component\Console\Command\Command::getHelper (
string $name
): \Symfony\Component\Console\Helper\HelperInterface

Gets a helper instance by name.

Parameters
$name: string
 
Exceptions

Throws \Symfony\Component\Console\Exception\LogicException if no HelperSet is defined

Throws \Symfony\Component\Console\Exception\InvalidArgumentException if the helper is not defined

getHelperSet()

public \Symfony\Component\Console\Command\Command::getHelperSet (
void
): ?\Symfony\Component\Console\Helper\HelperSet

Gets the helper set.

getName()

public \Symfony\Component\Console\Command\Command::getName (
void
): ?string

Returns the command name.

getNativeDefinition()

public \Symfony\Component\Console\Command\Command::getNativeDefinition (
void
): \Symfony\Component\Console\Input\InputDefinition

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.

getProcessedHelp()

public \Symfony\Component\Console\Command\Command::getProcessedHelp (
void
): string

Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.

getSubscribedSignals()

public \Symfony\Component\Console\Command\Command::getSubscribedSignals (
void
): array

Returns the list of signals to subscribe.

See

getSynopsis()

public \Symfony\Component\Console\Command\Command::getSynopsis (
bool $short = false
): string

Returns the synopsis for the command.

Parameters
$short: bool

Whether to show the short version of the synopsis (with options folded) or not

getUsages()

public \Symfony\Component\Console\Command\Command::getUsages (
void
): array

Returns alternative usages of the command.

handleSignal()

public \Symfony\Component\Console\Command\Command::handleSignal (
int $signal,
int|false $previousExitCode = 0
): int|false

The method will be called when the application is signaled.

Parameters
$signal: int
 
$previousExitCode: int|false
 
Return Values

The exit code to return or false to continue the normal execution

ignoreValidationErrors()

public \Symfony\Component\Console\Command\Command::ignoreValidationErrors (
void
): void

Ignores validation errors.

This is mainly useful for the help command.

initialize()

protected AbstractDefaultCommand::initialize (
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
): void
Parameters
$input: \Symfony\Component\Console\Input\InputInterface
 
$output: \Symfony\Component\Console\Output\OutputInterface
 
Exceptions

Throws \Throwable

interact()

protected \Symfony\Component\Console\Command\Command::interact (
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
): void

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.

Parameters
$input: \Symfony\Component\Console\Input\InputInterface
 
$output: \Symfony\Component\Console\Output\OutputInterface
 

isEnabled()

public \Symfony\Component\Console\Command\Command::isEnabled (
void
): bool

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 cannot run properly under the current conditions.

isHidden()

public \Symfony\Component\Console\Command\Command::isHidden (
void
): bool
Return Values

whether the command should be publicly shown or not

run()

public \Symfony\Component\Console\Command\Command::run (
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
): int

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.

Parameters
$input: \Symfony\Component\Console\Input\InputInterface
 
$output: \Symfony\Component\Console\Output\OutputInterface
 
Return Values

The command exit code

Exceptions

Throws \Symfony\Component\Console\Exception\ExceptionInterface When input binding fails. Bypass this by calling ignoreValidationErrors().

See
  • \Symfony\Component\Console\Command\Command::setCode()
  • \Symfony\Component\Console\Command\Command::execute()

setAliases()

public \Symfony\Component\Console\Command\Command::setAliases (
string[] $aliases
): static

Sets the aliases for the command.

Parameters
$aliases: string[]

An array of aliases for the command

Exceptions

Throws \Symfony\Component\Console\Exception\InvalidArgumentException When an alias is invalid

setApplication()

public \Symfony\Component\Console\Command\Command::setApplication (
?\Symfony\Component\Console\Application $application
): void
Parameters
$application: ?\Symfony\Component\Console\Application
 

setCode()

public \Symfony\Component\Console\Command\Command::setCode (
callable $code
): static

Sets the code to execute when running this command.

If this method is used, it overrides the code defined in the execute() method.

Parameters
$code: callable

A callable(InputInterface $input, OutputInterface $output)

Exceptions

Throws \Symfony\Component\Console\Exception\InvalidArgumentException

See
  • \Symfony\Component\Console\Command\Command::execute()

setDefinition()

public \Symfony\Component\Console\Command\Command::setDefinition (
array|\Symfony\Component\Console\Input\InputDefinition $definition
): static

Sets an array of argument and option instances.

Parameters
$definition: array|\Symfony\Component\Console\Input\InputDefinition
 

setDescription()

public \Symfony\Component\Console\Command\Command::setDescription (
string $description
): static

Sets the description for the command.

Parameters
$description: string
 

setHelp()

public \Symfony\Component\Console\Command\Command::setHelp (
string $help
): static

Sets the help for the command.

Parameters
$help: string
 

setHelperSet()

public \Symfony\Component\Console\Command\Command::setHelperSet (
\Symfony\Component\Console\Helper\HelperSet $helperSet
): void
Parameters
$helperSet: \Symfony\Component\Console\Helper\HelperSet
 

setHidden()

public \Symfony\Component\Console\Command\Command::setHidden (
bool $hidden = true
): static
Parameters
$hidden: bool

Whether or not the command should be hidden from the list of commands

setName()

public \Symfony\Component\Console\Command\Command::setName (
string $name
): static

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');
Parameters
$name: string
 
Exceptions

Throws \Symfony\Component\Console\Exception\InvalidArgumentException When the name is invalid

setProcessTitle()

public \Symfony\Component\Console\Command\Command::setProcessTitle (
string $title
): static

Sets the process title of the command.

This feature should be used only when creating a long process command, like a daemon.

Parameters
$title: string
 

validateName()

private \Symfony\Component\Console\Command\Command::validateName (
string $name
): void

Validates a command name.

It must be non-empty and parts can optionally be separated by ":".

Parameters
$name: string
 
Exceptions

Throws \Symfony\Component\Console\Exception\InvalidArgumentException When the name is invalid