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.6 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.6
      • 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 HelpFormatter

HelpFormatter formats help for console shells. Can format to either text or XML formats. Uses ConsoleOptionParser methods to generate help.

Generally not directly used. Using $parser->help($command, 'xml'); is usually how you would access help. Or via the --help=xml option on the command line.

Xml output is useful for integration with other tools like IDE's or other build tools.

Package: Cake\Console
Since: CakePHP(tm) v 2.0
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/HelpFormatter.php

Properties summary

  • $_maxArgs protected
    integer
    The maximum number of arguments shown when generating usage.
  • $_maxOptions protected
    integer
    The maximum number of options shown when generating usage.

Method Summary

  • __construct() public
    Build the help formatter for an OptionParser
  • _generateUsage() protected

    Generate the usage for a shell based on its arguments and options. Usage strings favor short options over the long ones. and optional args will be indicated with []

  • _getMaxLength() protected
    Iterate over a collection and find the longest named thing.
  • text() public
    Get the help as formatted text suitable for output on the command line.
  • xml() public
    Get the help as an xml string.

Method Detail

__construct() public ¶

__construct( ConsoleOptionParser $parser )

Build the help formatter for an OptionParser

Parameters
ConsoleOptionParser $parser
The option parser help is being generated for.

_generateUsage() protected ¶

_generateUsage( )

Generate the usage for a shell based on its arguments and options. Usage strings favor short options over the long ones. and optional args will be indicated with []

Returns
string

_getMaxLength() protected ¶

_getMaxLength( array $collection )

Iterate over a collection and find the longest named thing.

Parameters
array $collection
The collection to find a max length of.
Returns
integer

text() public ¶

text( integer $width = 72 )

Get the help as formatted text suitable for output on the command line.

Parameters
integer $width optional 72
The width of the help output.
Returns
string

xml() public ¶

xml( boolean $string = true )

Get the help as an xml string.

Parameters
boolean $string optional true
Return the SimpleXml object or a string. Defaults to true.
Returns
string|SimpleXmlElement
See $string

Properties detail

$_maxArgs ¶

protected integer

The maximum number of arguments shown when generating usage.

6

$_maxOptions ¶

protected integer

The maximum number of options shown when generating usage.

6
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