Apache Zeta Components Manual :: File Source for option_rule.php
Source for file option_rule.php
Documentation is available at option_rule.php
* File containing the ezcConsoleOptionRule class.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* @version //autogentag//
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* 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:
* - <b>option</b> <i>ezcConsoleOption</i>, contains the parameter that this rule refers to.
* - <b>values</b> <i>array(string)</i>, contains a list of values that are accepted.
* 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:
* $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
* $rule = new ezcConsoleOptionRule( $option, 'a' );
* to create a rule, that allows the desired option only to accept the
* 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
* @param ezcConsoleOption $option The option to refer to.
* @param mixed $values The affected values.
public function __construct( ezcConsoleOption $option, array $values =
array(), $ifSet =
true )
$this->__set( 'option', $option );
$this->__set( 'values', $values );
$this->__set( 'ifSet', $ifSet );
* @throws ezcBasePropertyNotFoundException
* If the the desired property is not found.
* @param string $propertyName Name of the property.
* @return mixed Value of the property or null.
public function __get( $propertyName )
* @param string $propertyName Name of the property.
* @param mixed $propertyValue The value for the property.
* @throws ezcBasePropertyPermissionException
* If the property you try to access is read-only.
* @throws ezcBasePropertyNotFoundException
* If the the desired property is not found.
public function __set( $propertyName, $propertyValue )
* @param string $propertyName Name of the property to check.
* @return bool If the property exists or not.
public function __isset( $propertyName )