Path

ez components / documentation / api reference / 2008.1 / workflow


Workflow

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Source for file xor.php

Documentation is available at xor.php

 1. <?php
 2. /**
 3.  * File containing the ezcWorkflowConditionXor class.
 4.  *
 5.  * @package Workflow
 6.  * @version 1.2
 7.  * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
 8.  * @license http://ez.no/licenses/new_bsd New BSD License
 9.  */
10.  
11. /**
12.  * Boolean XOR.
13.  *
14.  * An object of the ezcWorkflowConditionXor class represents a boolean XOR expression. It
15.  * can hold an arbitrary number of ezcWorkflowCondition objects.
16.  *
17.  * <code>
18.  * <?php
19.  * $xor = new ezcWorkflowConditionXor( array ( $condition , ... ) );
20.  * ?>
21.  * </code>
22.  *
23.  * @package Workflow
24.  * @version 1.2
25.  */
26. class ezcWorkflowConditionXor extends ezcWorkflowConditionBooleanSet
27. {
28.     /**
29.      * @var string 
30.      */
31.     protected $concatenation = 'XOR';
32.  
33.     /**
34.      * Evaluates this condition with $value and returns true if the condition holds and false otherwise.
35.      *
36.      * @param  mixed $value 
37.      * @return boolean true when the condition holds, false otherwise.
38.      * @ignore
39.      */
40.     public function evaluate$value )
41.     {
42.         $result false;
43.  
44.         foreach $this->conditions as $condition )
45.         {
46.             if $condition->evaluate$value ) )
47.             {
48.                 if $result )
49.                 {
50.                     return false;
51.                 }
52.  
53.                 $result true;
54.             }
55.         }
56.  
57.         return $result;
58.     }
59. }
60. ?>
Last updated: Wed, 18 Jun 2008