Oihana PHP Commands

CommandOptions extends Options

Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Constants

COMMAND  = 'command'
The 'command' parameter.

Properties

$certbot  : bool|null
Indicates if the command use certbot.
$clear  : bool
Indicates if the command clear the terminal when is launched.
$config  : string|null
The path of the config directory.
$dir  : string|null
The path of the command directory.
$nginx  : bool|null
Indicates if the command use nginx.
$owner  : string|null
Set the owner user to run the command as, if sudo is enabled.
$sudo  : bool|null
Whether to prefix the command with `sudo`.

Methods

__toString()  : string
Returns the string expression of the object.
getOptions()  : string
Builds a command-line string of options based on the current object state.

Constants

COMMAND

The 'command' parameter.

public mixed COMMAND = 'command'

Properties

$certbot

Indicates if the command use certbot.

public bool|null $certbot = true

$clear

Indicates if the command clear the terminal when is launched.

public bool $clear = false

$config

The path of the config directory.

public string|null $config = ''

$dir

The path of the command directory.

public string|null $dir = ''

$nginx

Indicates if the command use nginx.

public bool|null $nginx = true

$owner

Set the owner user to run the command as, if sudo is enabled.

public string|null $owner = null

$sudo

Whether to prefix the command with `sudo`.

public bool|null $sudo = false

Methods

__toString()

Returns the string expression of the object.

public __toString() : string
Return values
string

getOptions()

Builds a command-line string of options based on the current object state.

public getOptions([class-string $clazz = null ][, null|callable|string $prefix = Char::DOUBLE_HYPHEN ][, array<string|int, string> $excludes = null ][, callable|string $separator = Char::SPACE ][, array<string|int, string> $order = null ][, bool $reverseOrder = false ]) : string
Parameters
$clazz : class-string = null

Class implementing the getCommandOption(string $property): string method.

$prefix : null|callable|string = Char::DOUBLE_HYPHEN

Prefix for each option (e.g. '--', '-', '/opt:'), or a callable (string $property): string.

$excludes : array<string|int, string> = null

Optional list of property names to exclude from the output.

$separator : callable|string = Char::SPACE

Separator between option and value (default is a space), or a callable (string $property): string.

$order : array<string|int, string> = null

Optional list of property names to force order.

$reverseOrder : bool = false

If true, ordered properties are placed at the end instead of the beginning.

Return values
string

CLI-formatted options string, e.g. '--foo "bar" -v --list "one" --list "two"'


        
On this page

Search results