final class PackPackageCommand extends Command (View source)

Constants

deprecated RETURN_CODE_ON_SUCCESS

deprecated RETURN_CODE_ON_FAILURE

INVALID

Concrete requires symfony/console ^5.2, and the INVALID constant has been introduced in symfony/console 5.3.0

ALLOWASROOT_OPTION

The name of the CLI option that allows running CLI commands as root without confirmation.

ALLOWASROOT_ENV

The name of the environment variable that allows running CLI commands as root without confirmation.

SHORTTAGS_ALL

Convert all short PHP tags to long PHP tags (including short echo tags).

SHORTTAGS_KEEPECHO

Convert short PHP tags to long PHP tags (excluding short echo tags).

SHORTTAGS_AUTO

Use SHORTTAGS_ALL for Concrete 5.x packages, SHORTTAGS_KEEPECHO for Concrete 8+ packages.

SHORTTAGS_NO

Do not convert any short PHP tags.

KEEP_DOT

Keep files starting with a dot.

KEEP_SOURCES

Keep translation .po files and icon source .svg files.

KEEP_COMPOSER_JSON

Keep composer.json files.

KEEP_COMPOSER_LOCK

Keep composer.json and composer.lock files.

YNA_YES

Option for boolean/automatic flags: yes.

YNA_AUTO

Option for boolean/automatic flags: automatic.

YNA_NO

Option for boolean/automatic flags: no.

ZIPOUT_AUTO

Value of the zip option to be used to automatically determine the .zip file name.

Properties

protected InputInterface $input from  Command
protected OutputStyle $output from  Command
protected string $name from  Command
protected string $description from  Command
protected bool $hidden from  Command
protected string $signature

The command signature.

from  Command
protected bool $canRunAsRoot

Can this command be executed as root? If set to false, the command can be executed if one of these conditions is satisfied:

  • the users is not root
  • the --allow-as-root option is set
  • the C5_CLI_ALLOW_AS_ROOT environment variable is set
  • the console is interactive and the user explicitly confirm the operation.
from  Command

Methods

__construct($name = null)

No description

from  Command
run(InputInterface $input, OutputInterface $output)

{@inheritdoc}

from  Command
int
call(string $command, array $arguments = [])

Call another console command.

from  Command
int
callSilent(string $command, array $arguments = [])

Call another console command silently.

from  Command
bool
hasArgument(string|int $name)

Determine if the given argument is present.

from  Command
string|array
argument(string|null $key = null)

Get the value of a command argument.

from  Command
array
arguments()

Get all of the arguments passed to the command.

from  Command
bool
hasOption(string $name)

Determine if the given option is present.

from  Command
string|array
option(string $key = null)

Get the value of a command option.

from  Command
array
options()

Get all of the options passed to the command.

from  Command
bool
confirm(string $question, bool $default = false)

Confirm a question with the user.

from  Command
string
ask(string $question, string $default = null)

Prompt the user for input.

from  Command
string
askWithCompletion(string $question, array $choices, string $default = null, null $attempts = null, null $strict = null)

Prompt the user for input with auto completion.

from  Command
string
secret(string $question, bool $fallback = true)

Prompt the user for input but hide the answer from the console.

from  Command
string
choice(string $question, array $choices, string $default = null, mixed $attempts = null, bool $multiple = null)

Give the user a single choice from an array of answers.

from  Command
void
table(array $headers, array $rows, string $tableStyle = 'default', array $columnStyles = [])

Format input to textual table.

from  Command
Application|Application
getApplication()

{@inheritdoc}

from  Command
void
configureUsingFluentDefinition()

Configure the console command using a fluent definition.

from  Command
void
specifyParameters()

Specify the arguments and options on the command.

from  Command
array
getArguments()

Get the arguments for this command.

from  Command
array
getOptions()

Get the options for this command.

from  Command
initialize(InputInterface $input, OutputInterface $output)

{@inheritdoc}

from  Command
writeError(OutputInterface $output, Exception|Throwable $error) deprecated

Write an exception.

from  Command
addEnvOption()

Add the "env" option to the command options.

from  Command
$this
setCanRunAsRoot(bool $canRunAsRoot)

Allow/disallow running this command as root without confirmation.

from  Command
bool|null
isRunningAsRoot()

Is the current user root?

from  Command
confirmRunningAsRoot(InputInterface $input, OutputInterface $output)

No description

from  Command
int
execute(InputInterface $input, OutputInterface $output)

This method is overridden to pipe execution to the handle method hiding input and output.

from  Command
handle(Application $app, Inspector $packageInspector, PackagePacker $packer, Strings $stringsValidator, PackageService $packageService)

Execute the command.

configure()

{@inheritdoc}

parseInputArgument(Inspector $packageInspector, Strings $stringsValidator, PackageService $packageService)

Get the package details analyzing the command-line arguments.

createFilters(Application $app, PackageInfo $packageInfo)

Generate the filters analyzing the command-line options.

createWriters(Application $app, PackageInfo $packageInfo)

Generate the writers analyzing the command-line options.

Details

__construct($name = null)

No description

Parameters

$name

run(InputInterface $input, OutputInterface $output)

{@inheritdoc}

Parameters

InputInterface $input
OutputInterface $output

int call(string $command, array $arguments = [])

Call another console command.

Parameters

string $command
array $arguments

Return Value

int

int callSilent(string $command, array $arguments = [])

Call another console command silently.

Parameters

string $command
array $arguments

Return Value

int

bool hasArgument(string|int $name)

Determine if the given argument is present.

Parameters

string|int $name

Return Value

bool

string|array argument(string|null $key = null)

Get the value of a command argument.

Parameters

string|null $key

Return Value

string|array

array arguments()

Get all of the arguments passed to the command.

Return Value

array

bool hasOption(string $name)

Determine if the given option is present.

Parameters

string $name

Return Value

bool

string|array option(string $key = null)

Get the value of a command option.

Parameters

string $key

Return Value

string|array

array options()

Get all of the options passed to the command.

Return Value

array

bool confirm(string $question, bool $default = false)

Confirm a question with the user.

Parameters

string $question
bool $default

Return Value

bool

string ask(string $question, string $default = null)

Prompt the user for input.

Parameters

string $question
string $default

Return Value

string

string askWithCompletion(string $question, array $choices, string $default = null, null $attempts = null, null $strict = null)

Prompt the user for input with auto completion.

Parameters

string $question
array $choices
string $default
null $attempts
null $strict

Return Value

string

string secret(string $question, bool $fallback = true)

Prompt the user for input but hide the answer from the console.

Parameters

string $question
bool $fallback

Return Value

string

string choice(string $question, array $choices, string $default = null, mixed $attempts = null, bool $multiple = null)

Give the user a single choice from an array of answers.

Parameters

string $question
array $choices
string $default
mixed $attempts
bool $multiple

Return Value

string

void table(array $headers, array $rows, string $tableStyle = 'default', array $columnStyles = [])

Format input to textual table.

Parameters

array $headers
array $rows
string $tableStyle
array $columnStyles

Return Value

void

Application|Application getApplication()

{@inheritdoc}

Return Value

Application|Application

protected void configureUsingFluentDefinition()

Configure the console command using a fluent definition.

Return Value

void

protected void specifyParameters()

Specify the arguments and options on the command.

Return Value

void

protected array getArguments()

Get the arguments for this command.

If $this->signature is specified, this method has no effect.

Return Value

array

[[$name, $mode = null, $description = '', $default = null], ...]

protected array getOptions()

Get the options for this command.

If $this->signature is specified, this method has no effect.

Return Value

array

[[$name, $shortcut = null, $mode = null, $description = '', $default = null], ...]

protected initialize(InputInterface $input, OutputInterface $output)

{@inheritdoc}

Parameters

InputInterface $input
OutputInterface $output

See also

\Symfony\Component\Console\Command\Command::initialize()

protected writeError(OutputInterface $output, Exception|Throwable $error) deprecated

deprecated Use $this->output to manage your output

Write an exception.

Parameters

OutputInterface $output
Exception|Throwable $error

See also

\Concrete\Core\Console\OutputStyle::error()

protected Command addEnvOption()

Add the "env" option to the command options.

Return Value

Command

protected $this setCanRunAsRoot(bool $canRunAsRoot)

Allow/disallow running this command as root without confirmation.

Parameters

bool $canRunAsRoot

if false the command can be executed if one of these conditions is satisfied:

  • the users is not root
  • the --allow-as-root option is set
  • the C5_CLI_ALLOW_AS_ROOT environment variable is set
  • the console is interactive and the user explicitly confirm the operation

Return Value

$this

protected bool|null isRunningAsRoot()

Is the current user root?

Return Value

bool|null

NULL if unknown, or boolean if determined

protected confirmRunningAsRoot(InputInterface $input, OutputInterface $output)

No description

Parameters

InputInterface $input
OutputInterface $output

Exceptions

UserMessageException

protected int execute(InputInterface $input, OutputInterface $output)

This method is overridden to pipe execution to the handle method hiding input and output.

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

See also

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

handle(Application $app, Inspector $packageInspector, PackagePacker $packer, Strings $stringsValidator, PackageService $packageService)

Execute the command.

Parameters

Application $app
Inspector $packageInspector
PackagePacker $packer
Strings $stringsValidator
PackageService $packageService

protected configure()

{@inheritdoc}

See also

\Symfony\Component\Console\Command\Command::configure()

protected PackageInfo parseInputArgument(Inspector $packageInspector, Strings $stringsValidator, PackageService $packageService)

Get the package details analyzing the command-line arguments.

Parameters

Inspector $packageInspector
Strings $stringsValidator
PackageService $packageService

Return Value

PackageInfo

Exceptions

Exception

protected FilterInterface[] createFilters(Application $app, PackageInfo $packageInfo)

Generate the filters analyzing the command-line options.

Parameters

Application $app
PackageInfo $packageInfo

Return Value

FilterInterface[]

Exceptions

Exception

protected WriterInterface[] createWriters(Application $app, PackageInfo $packageInfo)

Generate the writers analyzing the command-line options.

Parameters

Application $app
PackageInfo $packageInfo

Return Value

WriterInterface[]

Exceptions

Exception