symfony API

sfTask Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.2 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.2 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

Abstract class for all tasks.

Inheritence

sfCommandApplicationTask  <  sfTask

Method Summary

  • addArgument($name, $mode = null, $help = &apos;&apos;, $default = null)
    Add an argument.
  • addArguments($arguments)
    Adds an array of argument objects.
  • addOption($name, $shortcut = null, $mode = null, $help = &apos;&apos;, $default = null)
    Add an option.
  • addOptions($options)
    Adds an array of option objects.
  • ask((string|array) $question, $style = &apos;QUESTION&apos;, 2)
    Asks a question to the user.
  • askConfirmation((string|array) $question, $style = &apos;QUESTION&apos;, (Boolean) $default = true, (Boolean) 3)
    Asks a confirmation to the user.
  • configure()
    Configures the current task.
  • doRun($commandManager, $options)
  • integer execute($arguments = array(), $options = array())
    Executes the current task.
  • array getAliases()
    Returns the aliases for the task.
  • getArguments()
    Returns the argument objects.
  • string getBriefDescription()
    Returns the brief description for the task.
  • string getDetailedDescription()
    Returns the detailed description for the task.
  • string getFullName()
    Returns the fully qualified task name.
  • string getName()
    Returns the task name
  • string getNamespace()
    Returns the task namespace.
  • getOptions()
    Returns the options objects.
  • string getSynopsis()
    Returns the synopsis for the task.
  • initialize($dispatcher, $formatter)
    Initializes the sfTask instance.
  • log($messages)
    Logs a message.
  • logBlock((string|array) $messages, $style)
    Logs a message as a block of text.
  • logSection($section, $message, $size = null, $style = &apos;INFO&apos;)
    Logs a message in a section.
  • process($commandManager, $options)
  • integer run($arguments = array(), $options = array())
    Runs the task.
  • integer runFromCLI($commandManager, $options = null)
    Runs the task from the CLI.
  • strlen($string)
  • __construct($dispatcher, $formatter)
    Constructor.

Method Details

  • addArgument ($name, $mode = null, $help = '', $default = null) Browse code

    $name
    $mode
    $help
    $default

    Add an argument.


    This method always use the sfCommandArgument class to create an option.

  • addArguments ($arguments) Browse code

    $arguments An array of arguments

    Adds an array of argument objects.

  • addOption ($name, $shortcut = null, $mode = null, $help = '', $default = null) Browse code

    $name
    $shortcut
    $mode
    $help
    $default

    Add an option.


    This method always use the sfCommandOption class to create an option.

  • addOptions ($options) Browse code

    $options An array of options

    Adds an array of option objects.

  • ask ((string|array) $question, $style = 'QUESTION', 2) Browse code

    $question The question to ask
    $style The style to use (QUESTION by default)
    2 The user answer

    Asks a question to the user.

  • askConfirmation ((string|array) $question, $style = 'QUESTION', (Boolean) $default = true, (Boolean) 3) Browse code

    $question The question to ask
    $style The style to use (QUESTION by default)
    $default The default answer if the user enters nothing
    3 true if the user has confirmed, false otherwise

    Asks a confirmation to the user.


    The question will be asked until the user answer by nothing, yes, or no.

  • configure () Browse code

    Configures the current task.

  • doRun ($commandManager, $options) Browse code

    $commandManager
    $options

  • (integer) execute ($arguments = array(), $options = array()) Browse code

    $arguments An array of arguments
    $options An array of options

    Executes the current task.

    returns 0 if everything went fine, or an error code

  • (array) getAliases () Browse code

    Returns the aliases for the task.

    returns An array of aliases for the task

  • getArguments () Browse code

    Returns the argument objects.

    returns An array of sfCommandArgument objects.

  • (string) getBriefDescription () Browse code

    Returns the brief description for the task.

    returns The brief description for the task

  • (string) getDetailedDescription () Browse code

    Returns the detailed description for the task.


    It also formats special string like [...|COMMENT] depending on the current formatter.

    returns The detailed description for the task

  • (string) getFullName () Browse code

    Returns the fully qualified task name.

    returns The fully qualified task name

  • (string) getName () Browse code

    Returns the task name

    returns The task name

  • (string) getNamespace () Browse code

    Returns the task namespace.

    returns The task namespace

  • getOptions () Browse code

    Returns the options objects.

    returns An array of sfCommandOption objects.

  • (string) getSynopsis () Browse code

    Returns the synopsis for the task.

    returns The synopsis

  • initialize ($dispatcher, $formatter) Browse code

    $dispatcher A sfEventDispatcher instance
    $formatter A sfFormatter instance

    Initializes the sfTask instance.

  • log ($messages) Browse code

    $messages The message as an array of lines of a single string

    Logs a message.

  • logBlock ((string|array) $messages, $style) Browse code

    $messages The message to display in the block
    $style The style to use

    Logs a message as a block of text.

  • logSection ($section, $message, $size = null, $style = 'INFO') Browse code

    $section The section name
    $message The message
    $size The maximum size of a line
    $style The color scheme to apply to the section string (INFO, ERROR, or COMMAND)

    Logs a message in a section.

  • process ($commandManager, $options) Browse code

    $commandManager
    $options

  • (integer) run ($arguments = array(), $options = array()) Browse code

    $arguments An array of arguments
    $options An array of options

    Runs the task.

    returns 0 if everything went fine, or an error code

  • (integer) runFromCLI ($commandManager, $options = null) Browse code

    $commandManager An sfCommandManager instance
    $options The command line options

    Runs the task from the CLI.

    returns 0 if everything went fine, or an error code

  • strlen ($string) Browse code

    $string

  • __construct ($dispatcher, $formatter) Browse code

    $dispatcher An sfEventDispatcher instance
    $formatter An sfFormatter instance

    Constructor.