\Inhere\Console\ConcernInputArgumentsTrait

Trait InputArgumentsTrait

Summary

Methods
Properties
Constants
bindArgument()
bindArguments()
getArgs()
getArguments()
setArgs()
hasArg()
getArgument()
getArg()
get()
getRequiredArg()
getFirstArg()
getSecondArg()
getStringArg()
getInt()
getIntArg()
getArrayArg()
getSameArg()
sameArg()
clearArgs()
No public properties found
No constants found
No protected methods found
$args
$binds
N/A
No private methods found
No private properties found
N/A

Properties

$args

$args : array

Input args data

Type

array

$binds

$binds : array

Bind an name for argument index

[ 'name1' => 0, 'name2' => 1, ]

Type

array

Methods

bindArgument()

bindArgument(string  $name, integer  $index) : self|mixed

Parameters

string $name
integer $index

Returns

self|mixed

bindArguments()

bindArguments(array  $map, boolean  $replace = false) 

Parameters

array $map

[ argName => index, ]

boolean $replace

getArgs()

getArgs() : array

Returns

array

getArguments()

getArguments() : array

Returns

array

setArgs()

setArgs(array  $args, boolean  $replace = false) 

Parameters

array $args
boolean $replace

hasArg()

hasArg(string|integer  $name) : boolean

Parameters

string|integer $name

Returns

boolean

getArgument()

getArgument(null|integer|string  $name, mixed  $default = null) : mixed

get Argument

Parameters

null|integer|string $name
mixed $default

Returns

mixed

getArg()

getArg(null|integer|string  $name, mixed  $default = null) : mixed

get Argument

Parameters

null|integer|string $name
mixed $default

Returns

mixed

get()

get(null|integer|string  $name, mixed  $default = null) : mixed

get Argument

Parameters

null|integer|string $name
mixed $default

Returns

mixed

getRequiredArg()

getRequiredArg(integer|string  $name, string  $errMsg = '') : mixed

Get a required argument

Parameters

integer|string $name

argument index or name

string $errMsg

Returns

mixed

getFirstArg()

getFirstArg(string  $default = '') : string

Get first argument

Parameters

string $default

Returns

string

getSecondArg()

getSecondArg(string  $default = '') : string

Get second argument

Parameters

string $default

Returns

string

getStringArg()

getStringArg(string|integer  $key, string  $default = '') : string

Get an string argument value

Parameters

string|integer $key
string $default

Returns

string

getInt()

getInt(string|integer  $key, integer  $default) : integer

Get an int argument value

Parameters

string|integer $key
integer $default

Returns

integer

getIntArg()

getIntArg(string|integer  $key, integer  $default) : integer

Get an int argument value

Parameters

string|integer $key
integer $default

Returns

integer

getArrayArg()

getArrayArg(string|integer  $key, array  $default = array()) : array

Get an array argument value

Parameters

string|integer $key
array $default

Returns

array

getSameArg()

getSameArg(array  $names, mixed  $default = null) : boolean|mixed|null

Get same args value eg: des description

$input->sameArg(['des', 'description']);

Parameters

array $names
mixed $default

Returns

boolean|mixed|null

sameArg()

sameArg(array  $names, mixed  $default = null) : mixed

Parameters

array $names
mixed $default

Returns

mixed

clearArgs()

clearArgs() 

clear args