Documentation

Environment extends BaseCommand
in package

Command to display the current environment, or set a new one in the `.env` file.

Table of Contents

$arguments  : array<string|int, mixed>
$commands  : Commands
$description  : string
$group  : string
$logger  : LoggerInterface
$name  : string
$options  : array<string|int, mixed>
$usage  : string
$arguments  : array<string, string>
The Command's arguments
$commands  : Commands
Instance of Commands so commands can call other commands.
$description  : string
The Command's short description
$group  : string
The group the command is lumped under when listing commands.
$logger  : LoggerInterface
The Logger to use for a command
$name  : string
The Command's name
$options  : array<string|int, mixed>
The Command's options
$usage  : string
The Command's usage
$knownTypes  : array<int, string>
Allowed values for environment. `testing` is excluded since spark won't work on it.
__construct()  : mixed
BaseCommand constructor.
__get()  : mixed
Makes it simple to access our protected properties.
__isset()  : bool
Makes it simple to check our protected properties.
getPad()  : int
Get pad for $key => $value array output
run()  : void
Actually execute a command.
setPad()  : string
Pads our string out so that all titles are the same length to nicely line up descriptions.
showHelp()  : mixed
Show Help includes (Usage, Arguments, Description, Options).
call()  : mixed
Can be used by a command to run other commands.
showError()  : mixed
A simple method to display an error with line/file, in child commands.
writeNewEnvironmentToEnvFile()  : bool

Properties

$arguments

public array<string|int, mixed> $arguments

$arguments

The Command's arguments

protected array<string, string> $arguments = ['environment' => '[Optional] The new environment to set. If none is provided, this will print the current environment.']

$commands

Instance of Commands so commands can call other commands.

protected Commands $commands

$description

The Command's short description

protected string $description = 'Retrieves the current environment, or set a new one.'

$group

The group the command is lumped under when listing commands.

protected string $group = 'CodeIgniter'

$name

The Command's name

protected string $name = 'env'

$options

The Command's options

protected array<string|int, mixed> $options = []

$usage

The Command's usage

protected string $usage = 'env [<environment>]'

$knownTypes

Allowed values for environment. `testing` is excluded since spark won't work on it.

private static array<int, string> $knownTypes = ['production', 'development']

Methods

__get()

Makes it simple to access our protected properties.

public __get(string $key) : mixed
Parameters
$key : string
Return values
mixed

__isset()

Makes it simple to check our protected properties.

public __isset(string $key) : bool
Parameters
$key : string
Return values
bool

getPad()

Get pad for $key => $value array output

public getPad(array<string|int, mixed> $array, int $pad) : int
Parameters
$array : array<string|int, mixed>
$pad : int
Tags
deprecated

Use setPad() instead.

codeCoverageIgnore
Return values
int

run()

Actually execute a command.

public run(array<string, mixed> $params) : void
Parameters
$params : array<string, mixed>
Tags
inheritDoc
Return values
void

setPad()

Pads our string out so that all titles are the same length to nicely line up descriptions.

public setPad(string $item, int $max[, int $extra = 2 ], int $indent) : string
Parameters
$item : string
$max : int
$extra : int = 2

How many extra spaces to add at the end

$indent : int
Return values
string

showHelp()

Show Help includes (Usage, Arguments, Description, Options).

public showHelp() : mixed
Return values
mixed

call()

Can be used by a command to run other commands.

protected call(string $command[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
$command : string
$params : array<string|int, mixed> = []
Tags
throws
ReflectionException
Return values
mixed

showError()

A simple method to display an error with line/file, in child commands.

protected showError(Throwable $e) : mixed
Parameters
$e : Throwable
Return values
mixed

writeNewEnvironmentToEnvFile()

private writeNewEnvironmentToEnvFile(string $newEnv) : bool
Parameters
$newEnv : string
Tags
see
https://regex101.com/r/4sSORp/1

for the regex in action

Return values
bool

Search results