Class Arguments
Provides an interface for interacting with a command's options and arguments.
Property Summary
Method Summary
- 
          __construct() publicConstructor 
- 
          getArgument() publicCheck if a positional argument exists by name 
- 
          getArgumentAt() publicGet positional arguments by index. 
- 
          getArguments() publicGet all positional arguments. 
- 
          getOption() publicGet an option's value or null 
- 
          getOptions() publicGet an array of all the options 
- 
          hasArgument() publicCheck if a positional argument exists by name 
- 
          hasArgumentAt() publicCheck if a positional argument exists 
- 
          hasOption() publicCheck if an option is defined and not null. 
Method Detail
__construct() ¶ public
__construct(string[] $args, array $options, string[] $argNames)Constructor
Parameters
- 
                string[]$args
- Positional arguments 
- 
                array$options
- Named arguments 
- 
                string[]$argNames
- List of argument names. Order is expected to be the same as $args. 
getArgument() ¶ public
getArgument(string $name): string|nullCheck if a positional argument exists by name
Parameters
- 
                string$name
- The argument name to check. 
Returns
string|nullgetArgumentAt() ¶ public
getArgumentAt(int $index): string|nullGet positional arguments by index.
Parameters
- 
                int$index
- The argument index to access. 
Returns
string|nullThe argument value or null
getOption() ¶ public
getOption(string $name): string|int|bool|nullGet an option's value or null
Parameters
- 
                string$name
- The name of the option to check. 
Returns
string|int|bool|nullThe option value or null.
hasArgument() ¶ public
hasArgument(string $name): boolCheck if a positional argument exists by name
Parameters
- 
                string$name
- The argument name to check. 
Returns
boolhasArgumentAt() ¶ public
hasArgumentAt(int $index): boolCheck if a positional argument exists
Parameters
- 
                int$index
- The argument index to check. 
Returns
boolhasOption() ¶ public
hasOption(string $name): boolCheck if an option is defined and not null.
Parameters
- 
                string$name
- The name of the option to check. 
Returns
bool