symfony API

sfTask Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 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, sfSymfonyTestTask  <  sfTask

Method Summary

  • addArgument()
    Add an argument.
  • addArguments($arguments)
    Adds an array of argument objects.
  • addOption()
    Add an option.
  • addOptions($options)
    Adds an array of option objects.
  • ask($question, $style, $default, )
    Asks a question to the user.
  • mixed askAndValidate($question, $validator, $options)
    Asks for a value and validates the response.
  • askConfirmation($question, $style, $default, )
    Asks a confirmation to the user.
  • string asXml()
    Returns an XML representation of a task.
  • configure()
    Configures the current task.
  • doRun()
  • integer execute($arguments, $options)
    Executes the current task.
  • array getAliases()
    Returns the aliases for the task.
  • sfCommandArgument getArguments()
    Returns the argument objects.
  • string getBriefDescription()
    Returns the brief description for the task.
  • string getDetailedDescription()
    Returns the detailed description for the task.
  • sfFormatter getFormatter()
    Returns the formatter instance.
  • string getFullName()
    Returns the fully qualified task name.
  • string getName()
    Returns the task name
  • string getNamespace()
    Returns the task namespace.
  • sfCommandOption 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($messages, $style)
    Logs a message as a block of text.
  • logSection($section, $message, $size, $style)
    Logs a message in a section.
  • process()
  • integer run($arguments, $options)
    Runs the task.
  • integer runFromCLI($commandManager, $options)
    Runs the task from the CLI.
  • setFormatter()
    Sets the formatter instance.
  • strlen()
  • __construct($dispatcher, $formatter)
    Constructor.

Method Details

  • addArgument ()

    Add an argument.


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

  • addArguments ($arguments)

    $arguments An array of arguments

    Adds an array of argument objects.

  • addOption ()

    Add an option.


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

  • addOptions ($options)

    $options An array of options

    Adds an array of option objects.

  • ask ($question, $style, $default, )

    $question The question to ask
    $style The style to use (QUESTION by default)
    $default The default answer if none is given by the user

    Asks a question to the user.

  • (mixed) askAndValidate ($question, $validator, $options)

    Asks for a value and validates the response.


    Available options:

    * value: A value to try against the validator before asking the user
    * attempts: Max number of times to ask before giving up (false by default, which means infinite)
    * style: Style for question output (QUESTION by default)

  • askConfirmation ($question, $style, $default, )

    $question The question to ask
    $style The style to use (QUESTION by default)
    $default The default answer if the user enters nothing

    Asks a confirmation to the user.


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

  • (string) asXml ()

    Returns an XML representation of a task.

    returns An XML string representing the task

  • configure ()

    Configures the current task.

  • doRun ()

  • (integer) execute ($arguments, $options)

    $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 ()

    Returns the aliases for the task.

    returns An array of aliases for the task

  • (sfCommandArgument) getArguments ()

    Returns the argument objects.

    returns An array of sfCommandArgument objects.

  • (string) getBriefDescription ()

    Returns the brief description for the task.

    returns The brief description for the task

  • (string) getDetailedDescription ()

    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

  • (sfFormatter) getFormatter ()

    Returns the formatter instance.

    returns The formatter instance

  • (string) getFullName ()

    Returns the fully qualified task name.

    returns The fully qualified task name

  • (string) getName ()

    Returns the task name

    returns The task name

  • (string) getNamespace ()

    Returns the task namespace.

    returns The task namespace

  • (sfCommandOption) getOptions ()

    Returns the options objects.

    returns An array of sfCommandOption objects.

  • (string) getSynopsis ()

    Returns the synopsis for the task.

    returns The synopsis

  • initialize ($dispatcher, $formatter)

    $dispatcher A sfEventDispatcher instance
    $formatter A sfFormatter instance

    Initializes the sfTask instance.

  • log ($messages)

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

    Logs a message.

  • logBlock ($messages, $style)

    $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, $style)

    $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 ()

  • (integer) run ($arguments, $options)

    $arguments An array of arguments or a string representing the CLI arguments and options
    $options An array of options

    Runs the task.

    returns 0 if everything went fine, or an error code

  • (integer) runFromCLI ($commandManager, $options)

    $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

  • setFormatter ()

    Sets the formatter instance.

  • strlen ()

  • __construct ($dispatcher, $formatter)

    $dispatcher An sfEventDispatcher instance
    $formatter An sfFormatter instance

    Constructor.