CliArgument
in package
Table of Contents
Properties
- $longName : string
- The long name
- $required : bool
- Is the argument required ?
- $shortName : string|null
- The short name
- $type : string|null
- The type
- $typeValidators : array<string|int, mixed>
- Registered regex for a type
Methods
- __construct() : mixed
- Constructor
- getLongCommand() : string
- getLongName() : string
- Get the long name
- getShortName() : string|null
- Get the short name
- getType() : string|null
- Get the type
- getTypeValidator() : AbstractType
- Get the type
- getUsageCommand() : string
- getValidatorByType() : AbstractType
- Get a type validator by type name
- getValueFrom() : mixed
- hasShortName() : bool
- Test argument has a short name
- isRequired() : bool
- Is this argument required ?
- isRequiringValue() : bool
- make() : CliArgument
- Make a CliArgument from config
- registerTypeValidator() : void
- Add the type validator to validate parameters
- setRequired() : CliArgument
- Set the required state
- validateParameter() : bool
- Add the type validator to validate parameters
- verify() : bool
Properties
$longName
The long name
protected
string
$longName
$required
Is the argument required ?
protected
bool
$required
$shortName
The short name
protected
string|null
$shortName
$type
The type
protected
string|null
$type
$typeValidators
Registered regex for a type
protected
static array<string|int, mixed>
$typeValidators
= []
Methods
__construct()
Constructor
public
__construct(string $longName, string|null $shortName, string|null $type[, bool $required = false ]) : mixed
Parameters
- $longName : string
- $shortName : string|null
- $type : string|null
- $required : bool = false
getLongCommand()
public
getLongCommand(mixed $value[, mixed $usage = false ]) : string
Parameters
- $value : mixed
- $usage : mixed = false
Return values
stringgetLongName()
Get the long name
public
getLongName() : string
Return values
stringgetShortName()
Get the short name
public
getShortName() : string|null
Return values
string|nullgetType()
Get the type
public
getType() : string|null
Return values
string|nullgetTypeValidator()
Get the type
public
getTypeValidator() : AbstractType
Return values
AbstractTypegetUsageCommand()
public
getUsageCommand() : string
Return values
stringgetValidatorByType()
Get a type validator by type name
public
static getValidatorByType(string $type) : AbstractType
Parameters
- $type : string
Return values
AbstractTypegetValueFrom()
public
getValueFrom(mixed $values) : mixed
Parameters
- $values : mixed
hasShortName()
Test argument has a short name
public
hasShortName() : bool
Return values
boolisRequired()
Is this argument required ?
public
isRequired() : bool
Return values
boolisRequiringValue()
public
isRequiringValue() : bool
Return values
boolmake()
Make a CliArgument from config
public
static make(string $name, string $config) : CliArgument
Parameters
- $name : string
- $config : string
Return values
CliArgumentregisterTypeValidator()
Add the type validator to validate parameters
public
static registerTypeValidator(AbstractType $type) : void
Parameters
- $type : AbstractType
setRequired()
Set the required state
public
setRequired(bool $required) : CliArgument
Parameters
- $required : bool
Return values
CliArgumentvalidateParameter()
Add the type validator to validate parameters
public
static validateParameter(string $type, mixed $value) : bool
Parameters
- $type : string
- $value : mixed
Return values
boolverify()
public
verify(mixed $value) : bool
Parameters
- $value : mixed