symfony API

sfTask 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:

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 () Browse code

    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 () Browse code

    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 ($question, $style, $default, ) Browse code

    $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) Browse code

    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, ) Browse code

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

    Returns an XML representation of a task.

    returns An XML string representing the task

  • configure () Browse code

    Configures the current task.

  • doRun () Browse code

  • (integer) execute ($arguments, $options) 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

  • (sfCommandArgument) 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

  • (sfFormatter) getFormatter () Browse code

    Returns the formatter instance.

    returns The formatter instance

  • (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

  • (sfCommandOption) 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 ($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, $style) 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 () Browse code

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

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

  • setFormatter () Browse code

    Sets the formatter instance.

  • strlen () Browse code

  • __construct ($dispatcher, $formatter) Browse code

    $dispatcher An sfEventDispatcher instance
    $formatter An sfFormatter instance

    Constructor.