API / Minn\Cli / OptionCommand

OptionCommand final class

Minn\Cli\OptionCommand · public/minn/src/Minn/Cli/OptionCommand.php · 200 lines

Options, read and written straight to the options table. Serialized values are decoded by the engine's own reader, and arrays written back in the stored form. The verbs take WP-CLI's bundled synopsis (Commands); the one written here stands when this WP-CLI has none.

Used by 1

Public

methodget(array $args, array $assocArgs): void#

Gets the value for an option.

## OPTIONS

<key> : Key for the option.

[--format=<format>] : Get value in a particular format. --- default: var_export options: - var_export - json - yaml ---

methodadd(array $args, array $assocArgs): void#

Adds a new option value.

## OPTIONS

<key> : The name of the option to add.

[<value>] : The value of the option to add. If omitted, the value is read from STDIN.

[--format=<format>] : The serialization format for the value. --- default: plaintext options: - plaintext - json ---

[--autoload=<autoload>] : Should this option be automatically loaded. --- options: - 'on' - 'off' - 'yes' - 'no' ---

methodupdate(array $args, array $assocArgs): void#

Updates an option value.

## OPTIONS

<key> : The name of the option to update.

[<value>] : The new value. If omitted, the value is read from STDIN.

[--autoload=<autoload>] : Requires WP 4.2. Should this option be automatically loaded. --- options: - 'on' - 'off' - 'yes' - 'no' ---

[--format=<format>] : The serialization format for the value. --- default: plaintext options: - plaintext - json ---

methoddelete(array $args, array $assocArgs): void#

Deletes an option.

## OPTIONS

<key>... : Key for the option.

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatereadValue(array $args, array $assocArgs): mixed#

The value argument, or STDIN when omitted; JSON decoded when asked.

privatedecode(string $stored): mixed#

A stored value as PHP data: serialized blobs decoded, anything else as the string it is.

privateencode(mixed $value): string#