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
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.5 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.5
      • 4.2
      • 4.1
      • 4.0
      • 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

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • ConsoleErrorHandler
  • ConsoleInput
  • ConsoleInputArgument
  • ConsoleInputOption
  • ConsoleInputSubcommand
  • ConsoleOptionParser
  • ConsoleOutput
  • HelpFormatter
  • Shell
  • ShellDispatcher
  • TaskCollection

Class ShellDispatcher

Shell dispatcher handles dispatching cli commands.

Package: Cake\Console
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/ShellDispatcher.php

Properties summary

  • $args public
    array
    Contains arguments parsed from the command line.
  • $params public
    array
    Contains command switches parsed from the command line.

Method Summary

  • __construct() public
    Constructor
  • _bootstrap() protected
    Initializes the environment and loads the CakePHP core.
  • _getShell() protected
    Get shell to use, either plugin shell or application shell
  • _initConstants() protected
    Defines core configuration.
  • _initEnvironment() protected
    Defines current working environment.
  • _parsePaths() protected
    Parses out the paths from from the argv
  • _stop() protected
    Stop execution of the current script
  • dispatch() public
    Dispatches a CLI request
  • help() public
    Shows console help. Performs an internal dispatch to the CommandList Shell
  • parseParams() public
    Parses command line options and extracts the directory paths from $params
  • run() public static
    Run the dispatcher
  • setErrorHandlers() public

    Set the error/exception handlers for the console based on the Error.consoleHandler, and Exception.consoleHandler values if they are set. If they are not set, the default ConsoleErrorHandler will be used.

  • shiftArgs() public
    Removes first argument and shifts other arguments up

Method Detail

__construct() public ¶

__construct( array $args = array() , boolean $bootstrap = true )

Constructor

The execution of the script is stopped after dispatching the request with a status code of either 0 or 1 according to the result of the dispatch.

Parameters
array $args optional array()
the argv from PHP
boolean $bootstrap optional true
Should the environment be bootstrapped.

_bootstrap() protected ¶

_bootstrap( )

Initializes the environment and loads the CakePHP core.

Returns
boolean
Success.

_getShell() protected ¶

_getShell( string $shell )

Get shell to use, either plugin shell or application shell

All paths in the loaded shell paths are searched.

Parameters
string $shell
Optionally the name of a plugin
Returns
mixed
An object
Throws
MissingShellException
when errors are encountered.

_initConstants() protected ¶

_initConstants( )

Defines core configuration.

_initEnvironment() protected ¶

_initEnvironment( )

Defines current working environment.

Throws
CakeException

_parsePaths() protected ¶

_parsePaths( array $args )

Parses out the paths from from the argv

Parameters
array $args
The argv to parse.

_stop() protected ¶

_stop( integer|string $status = 0 )

Stop execution of the current script

Parameters
integer|string $status optional 0
see http://php.net/exit for values

dispatch() public ¶

dispatch( )

Dispatches a CLI request

Returns
boolean
Throws
MissingShellMethodException

help() public ¶

help( )

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

parseParams() public ¶

parseParams( array $args )

Parses command line options and extracts the directory paths from $params

Parameters
array $args
Parameters to parse

run() public static ¶

run( array $argv )

Run the dispatcher

Parameters
array $argv
The argv from PHP

setErrorHandlers() public ¶

setErrorHandlers( )

Set the error/exception handlers for the console based on the Error.consoleHandler, and Exception.consoleHandler values if they are set. If they are not set, the default ConsoleErrorHandler will be used.

shiftArgs() public ¶

shiftArgs( )

Removes first argument and shifts other arguments up

Returns
mixed
Null if there are no arguments otherwise the shifted argument

Properties detail

$args ¶

public array

Contains arguments parsed from the command line.

array()

$params ¶

public array

Contains command switches parsed from the command line.

array()
OpenHub
Rackspace
Rackspace
  • 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
  • Slack
  • Paid Support

Generated using CakePHP API Docs