final class Arguments (View source)

The parsed command line: one command word, "--name=value" options and the remaining positional words. Options may appear before or after the command.

Methods

static Arguments
parse(array $argv)

No description

string|null
command()

No description

bool
has(string $name)

No description

string|null
value(string $name)

The option's value; null when absent or given without "=value"

int|null
positiveInt(string $name)

A positive integer option, null when absent.

array
unknownOptions(array $allowed)

Option names that are set but not in the allowed list.

array
positionals()

No description

Details

static Arguments parse(array $argv)

No description

Parameters

array $argv

The arguments without the script name

Return Value

Arguments

Exceptions

InvalidArgumentException

string|null command()

No description

Return Value

string|null

bool has(string $name)

No description

Parameters

string $name

Return Value

bool

string|null value(string $name)

The option's value; null when absent or given without "=value"

Parameters

string $name

Return Value

string|null

int|null positiveInt(string $name)

A positive integer option, null when absent.

Parameters

string $name

Return Value

int|null

Exceptions

InvalidArgumentException

array unknownOptions(array $allowed)

Option names that are set but not in the allowed list.

Parameters

array $allowed

Return Value

array

array positionals()

No description

Return Value

array