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 refered 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(),)
Property array containing this class' properties. |
Method Summary
|
public ezcConsoleOptionRule |
__construct(
$option, [$values = array()] )
Creates a new parameter rule. |
|
public mixed |
__get(
$propertyName )
Property read access overloading. |
|
public bool |
__isset(
$propertyName )
Property isset access. |
|
public void |
__set(
$propertyName, $val )
Property read access overloading. |
Methods
__construct
ezcConsoleOptionRule __construct(
ezcConsoleOption
$option, [
$values = array()] )
Creates a new parameter rule.
Creates a new parameter rule. Per default the $values parameter is an empty array, which determines that the parameter may accept any value. To indicate that a parameter may only have certain values, place them inside tha $values array. For example to indicate a parameter 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 a parameter, 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 parameter only to accept the value 'a'.
Parameters
| Name |
Type |
Description |
$option |
ezcConsoleOption |
The parameter to refer to. |
$values |
mixed |
The values $option may have assigned. |
__get
mixed __get(
string
$propertyName )
Property read access overloading.
Gain read access to properties.
Parameters
| Name |
Type |
Description |
$propertyName |
string |
Name of the property to access. |
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
If the property tried to access does not exist. |
__isset
bool __isset(
string
$propertyName )
Property isset access.
Parameters
| Name |
Type |
Description |
$propertyName |
string |
Name of the property. |
__set
void __set(
string
$propertyName,
$val )
Property read access overloading.
Gain read access to properties.
Parameters
| Name |
Type |
Description |
$propertyName |
string |
Name of the property to access. |
$val |
|
|
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
If the property tried to access does not exist. |
ezcBaseValueException |
If the value for a property is not in the correct range. |
Last updated: Fri, 02 Nov 2007