Path

ez components / documentation / api reference / 2007.2.1 / workflow


eZ Components 2007.2.1

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.1
 7.  * @copyright Copyright (C) 2005-2007 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.  *  $xor = new ezcWorkflowConditionXor ( array ( $condition , ... ) ) ;
19.  * </code>
20.  *
21.  * @package Workflow
22.  * @version 1.1
23.  */
24. class ezcWorkflowConditionXor extends ezcWorkflowConditionBooleanSet
25. {
26.     /**
27.      * @var string 
28.      */
29.     protected $concatenation = 'XOR';
30.  
31.     /**
32.      * Evaluates this condition with $value and returns true if the condition holds and false otherwise.
33.      *
34.      * @param  mixed $value 
35.      * @return boolean true when the condition holds, false otherwise.
36.      * @ignore
37.      */
38.     public function evaluate$value )
39.     {
40.         $result false;
41.  
42.         foreach $this->conditions as $condition )
43.         {
44.             if $condition->evaluate$value ) )
45.             {
46.                 if $result )
47.                 {
48.                     return false;
49.                 }
50.  
51.                 $result true;
52.             }
53.         }
54.  
55.         return $result;
56.     }
57. }
58. ?>
Last updated: Thu, 31 Jan 2008