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 3.10 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.10
      • 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
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
      • Constraint
      • Fixture
      • Stub
    • Utility
    • Validation
    • View

Class LegacyShellDispatcher

Allows injecting mock IO into shells

Namespace: Cake\TestSuite

Property Summary

  • $_aliases protected static
    array

    List of connected aliases.

  • $_io protected
    Cake\Console\ConsoleIo
  • $args public
    array

    Contains arguments parsed from the command line.

Method Summary

  • __construct() public

    Constructor

  • _bootstrap() protected

    Initializes the environment and loads the CakePHP core.

  • _createShell() protected

    Injects mock and stub io components into the shell

  • _dispatch() protected

    Dispatch a request.

  • _handleAlias() protected

    If the input matches an alias, return the aliased shell name

  • _initEnvironment() protected

    Defines current working environment.

  • _shellExists() protected

    Check if a shell class exists for the given name.

  • addShortPluginAliases() public

    For all loaded plugins, add a short alias

  • alias() public static

    Add an alias for a shell command.

  • dispatch() public

    Dispatches a CLI request

  • findShell() public

    Get shell to use, either plugin shell or application shell

  • help() public

    Shows console help. Performs an internal dispatch to the CommandList Shell

  • resetAliases() public static

    Clear any aliases that have been set.

  • run() public static

    Run the dispatcher

  • shiftArgs() public

    Removes first argument and shifts other arguments up

  • version() public

    Prints the currently installed version of CakePHP. Performs an internal dispatch to the CommandList Shell

Method Detail

__construct() ¶ public

__construct(array $args = [], bool $bootstrap = true, Cake\Console\ConsoleIo $io = null)

Constructor

Parameters
array $args optional

Argument array

bool $bootstrap optional

Initialize environment

Cake\Console\ConsoleIo $io optional

ConsoleIo

_bootstrap() ¶ protected

_bootstrap(): bool

Initializes the environment and loads the CakePHP core.

Returns
bool

_createShell() ¶ protected

_createShell(string $className, string $shortName): Cake\Console\Shell

Injects mock and stub io components into the shell

Parameters
string $className

Class name

string $shortName

Short name

Returns
Cake\Console\Shell

_dispatch() ¶ protected

_dispatch(array $extra = []): bool|int|null

Dispatch a request.

Parameters
array $extra optional

Extra parameters that you can manually pass to the Shell to be dispatched. Built-in extra parameter is :

  • requested : if used, will prevent the Shell welcome message to be displayed
Returns
bool|int|null
Throws
Cake\Console\Exception\MissingShellMethodException

_handleAlias() ¶ protected

_handleAlias(string $shell): string

If the input matches an alias, return the aliased shell name

Parameters
string $shell

Optionally the name of a plugin or alias

Returns
string

_initEnvironment() ¶ protected

_initEnvironment(): void

Defines current working environment.

Returns
void
Throws
Cake\Core\Exception\Exception

_shellExists() ¶ protected

_shellExists(string $shell): string|false

Check if a shell class exists for the given name.

Parameters
string $shell

The shell name to look for.

Returns
string|false

addShortPluginAliases() ¶ public

addShortPluginAliases(): array

For all loaded plugins, add a short alias

This permits a plugin which implements a shell of the same name to be accessed Using the shell name alone

Returns
array

alias() ¶ public static

alias(string $short, string|null $original = null): string|false

Add an alias for a shell command.

Aliases allow you to call shells by alternate names. This is most useful when dealing with plugin shells that you want to have shorter names for.

If you re-use an alias the last alias set will be the one available.

Usage

Aliasing a shell named ClassName:

$this->alias('alias', 'ClassName');

Getting the original name for a given alias:

$this->alias('alias');
Parameters
string $short

The new short name for the shell.

string|null $original optional

The original full name for the shell.

Returns
string|false

dispatch() ¶ public

dispatch(array $extra = []): int

Dispatches a CLI request

Converts a shell command result into an exit code. Null/True are treated as success. All other return values are an error.

Parameters
array $extra optional

Extra parameters that you can manually pass to the Shell to be dispatched. Built-in extra parameter is :

  • requested : if used, will prevent the Shell welcome message to be displayed
Returns
int

findShell() ¶ public

findShell(string $shell): Cake\Console\Shell

Get shell to use, either plugin shell or application shell

All paths in the loaded shell paths are searched, handles alias dereferencing

Parameters
string $shell

Optionally the name of a plugin

Returns
Cake\Console\Shell
Throws
Cake\Console\Exception\MissingShellException
when errors are encountered.

help() ¶ public

help(): void

Shows console help. Performs an internal dispatch to the CommandList Shell

Returns
void

resetAliases() ¶ public static

resetAliases(): void

Clear any aliases that have been set.

Returns
void

run() ¶ public static

run(array $argv, array $extra = []): int

Run the dispatcher

Parameters
array $argv

The argv from PHP

array $extra optional

Extra parameters

Returns
int

shiftArgs() ¶ public

shiftArgs(): mixed

Removes first argument and shifts other arguments up

Returns
mixed

version() ¶ public

version(): void

Prints the currently installed version of CakePHP. Performs an internal dispatch to the CommandList Shell

Returns
void

Property Detail

$_aliases ¶ protected static

List of connected aliases.

Type
array

$_io ¶ protected

Type
Cake\Console\ConsoleIo

$args ¶ public

Contains arguments parsed from the command line.

Type
array
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