Console_CommandLine
[ class tree: Console_CommandLine ] [ index: Console_CommandLine ] [ all elements ]

Class: Console_CommandLine_Action_Callback

Source Location: /Console_CommandLine-1.2.0/Console/CommandLine/Action/Callback.php

Class Overview

Console_CommandLine_Action
   |
   --Console_CommandLine_Action_Callback

Class that represent the Callback action.


Author(s):

Version:

  • Release: 1.2.0

Copyright:

  • 2007 David JEAN LOUIS

Methods


Inherited Variables

Inherited Methods

Class: Console_CommandLine_Action

Console_CommandLine_Action::__construct()
Constructor
Console_CommandLine_Action::execute()
Executes the action with the value entered by the user.
Console_CommandLine_Action::format()
Allow a value to be pre-formatted prior to being used in a choices test.
Console_CommandLine_Action::getResult()
Convenience method to retrieve the value of result->options[name].
Console_CommandLine_Action::setResult()
Convenience method to assign the result->options[name] value.

Class Details

[line 62]
Class that represent the Callback action.

The result option array entry value is set to the return value of the callback defined in the option.

There are two steps to defining a callback option:

  • define the option itself using the callback action
  • write the callback; this is a function (or method) that takes five arguments, as described below.
All callbacks are called as follows:
  1.  callable_func(
  2.      $value,           // the value of the option
  3.      $option_instance// the option instance
  4.      $result_instance// the result instance
  5.      $parser_instance// the parser instance
  6.      $params           // an array of params as specified in the option
  7.  );
and *must* return the option value.



[ Top ]


Method Detail

execute   [line 74]

string execute( [mixed $value = false], [array $params = array()])

Executes the action with the value entered by the user.
  • Access: public

Overrides Console_CommandLine_Action::execute() (Executes the action with the value entered by the user.)

Parameters:

mixed   $value     The value of the option
array   $params     An optional array of parameters

[ Top ]


Documentation generated on Thu, 25 Oct 2012 08:00:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.