Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcConsoleOptionRule

ConsoleTools::ezcConsoleOptionRule

Class ezcConsoleOptionRule

Struct class to store a parameter rule.

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.

Source for this file: /ConsoleTools/src/structs/option_rule.php

Version:   //autogen//

Member Variables

protected array $properties = array(
'option' => null,
'values' => array(),'ifSet'=>true)

Properties.

Method Summary

public ezcConsoleOptionRule __construct( $option , [ $values = array()] , [ $ifSet = true] )
Creates a new option rule.

Methods

__construct

ezcConsoleOptionRule __construct( ezcConsoleOption $option , [ $values = array()] , [bool $ifSet = true] )

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'.

The $ifSet parameter determines, if the rule is validated when its option is set or left out. If $ifSet is true, the rule is validated when the option is set. Otherwise the rule is validated if the option was not set by the user.

Parameters:
Name Type Description
$option ezcConsoleOption The option to refer to.
$values mixed The affected values.
$ifSet bool
Documentation generated by phpDocumentor 1.4.3