PHP Class 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.
Author: Steve Clay ([email protected])
Datei anzeigen Open project: mrclay/minify

Protected Properties

Property Type Description
$description string
$required boolean
$spec array

Public Methods

Method Description
__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.

Method Details

__call() public method

Note: magic methods declared in class PHPDOC
public __call ( string $name, array $args = [] ) : Arg
$name string
$args array
return Arg

__construct() public method

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

__get() public method

Note: magic properties declared in class PHPDOC
public __get ( string $name ) : boolean | null
$name string
return boolean | null

getDefaultSpec() public method

public getDefaultSpec ( ) : array
return array

getDescription() public method

public getDescription ( ) : string
return string

getSpec() public method

public getSpec ( ) : array
return array

isRequired() public method

public isRequired ( ) : boolean
return boolean

setDescription() public method

public setDescription ( string $desc ) : Arg
$desc string
return Arg

useAsInfile() public method

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
return Arg

useAsOutfile() public method

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
return Arg

Property Details

$description protected_oe property

protected string $description
return string

$required protected_oe property

protected bool $required
return boolean

$spec protected_oe property

protected array $spec
return array