W3cubDocs

/CakePHP 3.5

Class Arguments

Provides an interface for interacting with a command's options and arguments.

Namespace: Cake\Console
Location: Console/Arguments.php

Properties summary

  • $argNames protected
    string[]
    Positional argument name map
  • $args protected
    string[]
    Positional arguments.
  • $options protected
    array
    Named options

Method Summary

Method Detail

__construct()source public

__construct( array $args , array $options , array $argNames )

Constructor

Parameters

array $args
Positional arguments
array $options
Named arguments
array $argNames

List of argument names. Order is expected to be the same as $args.

getArgument()source public

getArgument( string $name )

Check if a positional argument exists by name

Parameters

string $name
The argument name to check.

Returns

string|null

getArgumentAt()source public

getArgumentAt( integer $index )

Get positional arguments by index.

Parameters

integer $index
The argument index to access.

Returns

string|null
The argument value or null

getArguments()source public

getArguments( )

Get all positional arguments.

Returns

string[]

hasArgument()source public

hasArgument( string $name )

Check if a positional argument exists by name

Parameters

string $name
The argument name to check.

Returns

boolean

hasArgumentAt()source public

hasArgumentAt( integer $index )

Check if a positional argument exists

Parameters

integer $index
The argument index to check.

Returns

boolean

Properties detail

$argNamessource

protected string[]

Positional argument name map

$argssource

protected string[]

Positional arguments.

$optionssource

protected array

Named options

© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.5/class-Cake.Console.Arguments.html