CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 5.1 Chiffon API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 5.1
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Cache
    • Collection
    • Command
    • Console
      • Command
      • Exception
      • TestSuite
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Class Arguments

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

Namespace: Cake\Console

Property Summary

  • $argNames protected
    array<int, string>

    Positional argument name map

  • $args protected
    array<int, string>

    Positional arguments.

  • $options protected
    array<string, list<string>|string|bool|null>

    Named options

Method Summary

  • __construct() public

    Constructor

  • assertArgumentExists() protected
  • getArgument() public

    Returns positional argument value by name or null if doesn't exist

  • getArgumentAt() public

    Get positional arguments by index.

  • getArguments() public

    Get all positional arguments.

  • getBooleanOption() public

    Get a boolean option's value or null if not set.

  • getMultipleOption() public

    Gets a multiple option's value or null if not set.

  • getOption() public

    Get a non-multiple option's value or null if not set.

  • getOptions() public

    Get an array of all the options

  • hasArgument() public

    Check if a positional argument exists by name

  • hasArgumentAt() public

    Check if a positional argument exists by index

  • hasOption() public

    Check if an option is defined and not null.

Method Detail

__construct() ¶ public

__construct(array<int, string> $args, array<string, list<string>|string|bool|null> $options, array<int, string> $argNames)

Constructor

Parameters
array<int, string> $args

Positional arguments

array<string, list<string>|string|bool|null> $options

Named arguments

array<int, string> $argNames

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

assertArgumentExists() ¶ protected

assertArgumentExists(string $name): void
Parameters
string $name
Returns
void

getArgument() ¶ public

getArgument(string $name): string|null

Returns positional argument value by name or null if doesn't exist

Parameters
string $name

The argument name to check.

Returns
string|null

getArgumentAt() ¶ public

getArgumentAt(int $index): string|null

Get positional arguments by index.

Parameters
int $index

The argument index to access.

Returns
string|null

getArguments() ¶ public

getArguments(): array<int, string>

Get all positional arguments.

Returns
array<int, string>

getBooleanOption() ¶ public

getBooleanOption(string $name): bool|null

Get a boolean option's value or null if not set.

Parameters
string $name

Name

Returns
bool|null

getMultipleOption() ¶ public

getMultipleOption(string $name): list<string>|null

Gets a multiple option's value or null if not set.

Parameters
string $name
Returns
list<string>|null

getOption() ¶ public

getOption(string $name): string|bool|null

Get a non-multiple option's value or null if not set.

Parameters
string $name

The name of the option to check.

Returns
string|bool|null

getOptions() ¶ public

getOptions(): array<string, list<string>|string|bool|null>

Get an array of all the options

Returns
array<string, list<string>|string|bool|null>

hasArgument() ¶ public

hasArgument(string $name): bool

Check if a positional argument exists by name

Parameters
string $name

The argument name to check.

Returns
bool

hasArgumentAt() ¶ public

hasArgumentAt(int $index): bool

Check if a positional argument exists by index

Parameters
int $index

The argument index to check.

Returns
bool

hasOption() ¶ public

hasOption(string $name): bool

Check if an option is defined and not null.

Parameters
string $name

The name of the option to check.

Returns
bool

Property Detail

$argNames ¶ protected

Positional argument name map

Type
array<int, string>

$args ¶ protected

Positional arguments.

Type
array<int, string>

$options ¶ protected

Named options

Type
array<string, list<string>|string|bool|null>
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs