symfony API

sfCommandApplication Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.4 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:

sfCommandApplication manages the lifecycle of a CLI application.

Inheritence

sfSymfonyCommandApplication  <  sfCommandApplication

Method Summary

  • array autodiscoverTasks()
    Autodiscovers task classes.
  • clearTasks()
  • configure()
    Configures the current command application.
  • fixCgi()
    Fixes php behavior if using cgi php.
  • getAbbreviations()
    Returns an array of possible abbreviations given a set of names.
  • sfFormatter getFormatter()
    Returns the formatter instance.
  • string getLongVersion()
    Returns the long version of the application.
  • string getName()
    Gets the name of the application.
  • mixed getOption($name)
    Returns the value of a given option.
  • sfTask getTask($name)
    Returns a registered task by name or alias.
  • array getTasks()
    Returns all registered tasks.
  • sfTask getTaskToExecute($name)
    Gets a task from a task name or a shortcut.
  • string getVersion()
    Gets the application version.
  • sfFormatter guessBestFormatter($stream)
    Guesses the best formatter for the stream.
  • handleOptions($options)
    Parses and handles command line options.
  • help()
    Outputs a help message for the current application.
  • Boolean isStreamSupportsColors($stream)
    Returns true if the stream supports colorization.
  • Boolean isVerbose()
    Returns whether the application must be verbose.
  • registerTask($task)
    Registers a task object.
  • registerTasks($tasks)
    Registers an array of task objects.
  • renderException($e)
    Renders an exception.
  • integer run($options)
    Runs the current application.
  • setFormatter()
    Sets the formatter instance.
  • setName($name)
    Sets the application name.
  • setVersion($version)
    Sets the application version.
  • strlen()
  • Boolean withTrace()
    Returns whether the application must activate the trace.
  • __construct($dispatcher, $formatter, $options)
    Constructor.

Method Details

  • (array) autodiscoverTasks () Browse code

    Autodiscovers task classes.

    returns An array of tasks instances

  • clearTasks () Browse code

  • configure () Browse code

    Configures the current command application.

  • fixCgi () Browse code

    Fixes php behavior if using cgi php.

  • getAbbreviations () Browse code

    Returns an array of possible abbreviations given a set of names.

  • (sfFormatter) getFormatter () Browse code

    Returns the formatter instance.

    returns The formatter instance

  • (string) getLongVersion () Browse code

    Returns the long version of the application.

    returns The long application version

  • (string) getName () Browse code

    Gets the name of the application.

    returns The application name

  • (mixed) getOption ($name) Browse code

    $name The option name

    Returns the value of a given option.

    returns The option value

  • (sfTask) getTask ($name) Browse code

    $name The task name or alias

    Returns a registered task by name or alias.

    returns An sfTask object

  • (array) getTasks () Browse code

    Returns all registered tasks.

    returns An array of sfTask objects

  • (sfTask) getTaskToExecute ($name) Browse code

    $name The task name or a task shortcut

    Gets a task from a task name or a shortcut.

    returns A sfTask object

  • (string) getVersion () Browse code

    Gets the application version.

    returns The application version

  • (sfFormatter) guessBestFormatter ($stream) Browse code

    $stream A stream

    Guesses the best formatter for the stream.

    returns A formatter instance

  • handleOptions ($options) Browse code

    $options The command line options

    Parses and handles command line options.

  • help () Browse code

    Outputs a help message for the current application.

  • (Boolean) isStreamSupportsColors ($stream) Browse code

    $stream A stream

    Returns true if the stream supports colorization.


    Colorization is disabled if not supported by the stream:

    - windows without ansicon
    - non tty consoles

    returns true if the stream supports colorization, false otherwise

  • (Boolean) isVerbose () Browse code

    Returns whether the application must be verbose.

    returns true if the application must be verbose, false otherwise

  • registerTask ($task) Browse code

    $task An sfTask object

    Registers a task object.

  • registerTasks ($tasks) Browse code

    $tasks An array of tasks

    Registers an array of task objects.


    If you pass null, this method will register all available tasks.

  • renderException ($e) Browse code

    $e An exception object

    Renders an exception.

  • (integer) run ($options) Browse code

    $options The command line options

    Runs the current application.

    returns 0 if everything went fine, or an error code

  • setFormatter () Browse code

    Sets the formatter instance.

  • setName ($name) Browse code

    $name The application name

    Sets the application name.

  • setVersion ($version) Browse code

    $version The application version

    Sets the application version.

  • strlen () Browse code

  • (Boolean) withTrace () Browse code

    Returns whether the application must activate the trace.

    returns true if the application must activate the trace, false otherwise

  • __construct ($dispatcher, $formatter, $options) Browse code

    $dispatcher A sfEventDispatcher instance
    $formatter A sfFormatter instance
    $options An array of options

    Constructor.