Path

ez components / documentation / api reference / 2008.1 / workflow


Workflow

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

Source for file condition_boolean_set.php

Documentation is available at condition_boolean_set.php

 1. <?php
 2. /**
 3.  * File containing the ezcWorkflowConditionBooleanSet 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.  * Abstract base class for boolean sets of conditions like AND, OR and XOR.
13.  *
14.  * @package Workflow
15.  * @version 1.2
16.  */
17. abstract class ezcWorkflowConditionBooleanSet implements ezcWorkflowCondition
18. {
19.     /**
20.      * Array of ezcWorkflowConditions
21.      *
22.      * @var array 
23.      */
24.     protected $conditions;
25.  
26.     /**
27.      * String representation of the concatination.
28.      *
29.      * Used by the __toString() methods.
30.      *
31.      * @var string 
32.      */
33.     protected $concatenation;
34.  
35.     /**
36.      * Constructs a new boolean set with the conditions $conditions.
37.      *
38.      * The format of $conditions must be array( ezcWorkflowCondition )
39.      *
40.      * @param array $conditions 
41.      * @throws ezcWorkflowDefinitionStorageException
42.      */
43.     public function __constructarray $conditions )
44.     {
45.         foreach $conditions as $condition )
46.         {
47.             if !$condition instanceof ezcWorkflowCondition )
48.             {
49.                 throw new ezcWorkflowDefinitionStorageException(
50.                   'Array does not contain (only) ezcWorkflowCondition objects.'
51.                 );
52.             }
53.  
54.             $this->conditions[$condition;
55.         }
56.     }
57.  
58.     /**
59.      * Returns the conditions in this boolean set.
60.      *
61.      * @return ezcWorkflowCondition[] 
62.      * @ignore
63.      */
64.     public function getConditions()
65.     {
66.         return $this->conditions;
67.     }
68.  
69.     /**
70.      * Returns a textual representation of this condition.
71.      *
72.      * @return string 
73.      * @ignore
74.      */
75.     public function __toString()
76.     {
77.         $string '( ';
78.  
79.         foreach $this->conditions as $condition )
80.         {
81.             if $string != '( ' )
82.             {
83.                 $string .= ' ' $this->concatenation ' ';
84.             }
85.  
86.             $string .= $condition->__toString();
87.         }
88.  
89.         return $string ' )';
90.     }
91. }
92. ?>
Last updated: Wed, 18 Jun 2008