PHP Класс MrClay\Cli\Arg

By default, the argument will be assumed to be an optional letter flag with no value following. If the argument may receive a value, call mayHaveValue(). If there's whitespace after the flag, the value will be returned as true instead of the string. If the argument MUST be accompanied by a value, call mustHaveValue(). In this case, whitespace is permitted between the flag and its value. Use assertFile() or assertDir() to indicate that the argument must return a string value specifying a file or directory. During validation, the value will be resolved to a full file/dir path (not necessarily existing!) and the original value will be accessible via a "*.raw" key. E.g. $cli->values['f.raw'] Use assertReadable()/assertWritable() to cause the validator to test the file/dir for read/write permissions respectively.
Автор: Steve Clay ([email protected])
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$description string
$required boolean
$spec array

Открытые методы

Метод Описание
__call ( string $name, array $args = [] ) : Arg Note: magic methods declared in class PHPDOC
__construct ( boolean $isRequired = false )
__get ( string $name ) : boolean | null Note: magic properties declared in class PHPDOC
getDefaultSpec ( ) : array
getDescription ( ) : string
getSpec ( ) : array
isRequired ( ) : boolean
setDescription ( string $desc ) : Arg
useAsInfile ( ) : Arg Assert that the argument's value points to a readable file. When Cli::openInput() is called, a read pointer to this file will be provided.
useAsOutfile ( ) : Arg Assert that the argument's value points to a writable file. When Cli::openOutput() is called, a write pointer to this file will be provided.

Описание методов

__call() публичный Метод

Note: magic methods declared in class PHPDOC
public __call ( string $name, array $args = [] ) : Arg
$name string
$args array
Результат Arg

__construct() публичный Метод

public __construct ( boolean $isRequired = false )
$isRequired boolean

__get() публичный Метод

Note: magic properties declared in class PHPDOC
public __get ( string $name ) : boolean | null
$name string
Результат boolean | null

getDefaultSpec() публичный Метод

public getDefaultSpec ( ) : array
Результат array

getDescription() публичный Метод

public getDescription ( ) : string
Результат string

getSpec() публичный Метод

public getSpec ( ) : array
Результат array

isRequired() публичный Метод

public isRequired ( ) : boolean
Результат boolean

setDescription() публичный Метод

public setDescription ( string $desc ) : Arg
$desc string
Результат Arg

useAsInfile() публичный Метод

Assert that the argument's value points to a readable file. When Cli::openInput() is called, a read pointer to this file will be provided.
public useAsInfile ( ) : Arg
Результат Arg

useAsOutfile() публичный Метод

Assert that the argument's value points to a writable file. When Cli::openOutput() is called, a write pointer to this file will be provided.
public useAsOutfile ( ) : Arg
Результат Arg

Описание свойств

$description защищенное свойство

protected string $description
Результат string

$required защищенное свойство

protected bool $required
Результат boolean

$spec защищенное свойство

protected array $spec
Результат array