ConsoleTools: ezcConsoleOptionRule
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcConsoleOptionRule
|
Struct class to store a parameter rule. [
source]
This struct stores relation rules between parameters. A relation consists of a parameter that the relation refers to and optionally the value(s) the referred parameter may have assigned. Rules may be used for dependencies and exclusions between parameters.
The ezcConsoleOptionRule class has the following properties:
- option ezcConsoleOption, contains the parameter that this rule refers to.
- values array(string), contains a list of values that are accepted.
Member Variables
|
protected array |
$properties
= array( 'option' => null, 'values' => array(),)
Properties. |
Method Summary
|
public ezcConsoleOptionRule |
__construct(
$option, [$values = array()] )
Creates a new option rule. |
Methods
__construct
ezcConsoleOptionRule __construct(
ezcConsoleOption
$option, [
$values = array()] )
Creates a new option rule.
Creates a new option rule. Per default the $values parameter is an empty array, which determines that the option may accept any value. To indicate that a option may only have certain values, place them inside tha $values array. For example to indicate an option may have the values 'a', 'b' and 'c' use:
1. $rule = new ezcConsoleOptionRule( $option, array( 'a', 'b', 'c' ) );
If you want to allow only 1 specific value for an option, you do not need to wrap this into an array, when creating the rule. Simply use
1. $rule = new ezcConsoleOptionRule( $option, 'a' );
to create a rule, that allows the desired option only to accept the value 'a'.
Parameters
| Name |
Type |
Description |
$option |
ezcConsoleOption |
The option to refer to. |
$values |
mixed |
The affected values. |
Last updated: Mon, 17 Dec 2007