Author: sb
Date: Fri Aug 10 10:11:05 2007
New Revision: 5859
Log:
- Make constructor argument optional.
- Add setValue() and getOperator() methods.
- Refactor __toString() methods.
Modified:
trunk/Workflow/src/conditions/is_equal.php
trunk/Workflow/src/conditions/is_equal_or_greater_than.php
trunk/Workflow/src/conditions/is_equal_or_less_than.php
trunk/Workflow/src/conditions/is_greater_than.php
trunk/Workflow/src/conditions/is_less_than.php
trunk/Workflow/src/conditions/is_not_equal.php
trunk/Workflow/src/interfaces/condition_comparison.php
Modified: trunk/Workflow/src/conditions/is_equal.php
==============================================================================
--- trunk/Workflow/src/conditions/is_equal.php [iso-8859-1] (original)
+++ trunk/Workflow/src/conditions/is_equal.php [iso-8859-1] Fri Aug 10 10:11:05
2007
@@ -26,6 +26,11 @@
class ezcWorkflowConditionIsEqual extends ezcWorkflowConditionComparison
{
/**
+ * @var mixed
+ */
+ protected $operator = '==';
+
+ /**
* Evaluates this condition with $value and returns true if it is false or
false if it is not.
*
* @param mixed $value
@@ -36,16 +41,5 @@
{
return $value == $this->value;
}
-
- /**
- * Returns a textual representation of this condition.
- *
- * @return string
- * @ignore
- */
- public function __toString()
- {
- return '== ' . $this->value;
- }
}
?>
Modified: trunk/Workflow/src/conditions/is_equal_or_greater_than.php
==============================================================================
--- trunk/Workflow/src/conditions/is_equal_or_greater_than.php [iso-8859-1]
(original)
+++ trunk/Workflow/src/conditions/is_equal_or_greater_than.php [iso-8859-1] Fri
Aug 10 10:11:05 2007
@@ -26,6 +26,11 @@
class ezcWorkflowConditionIsEqualOrGreaterThan extends
ezcWorkflowConditionComparison
{
/**
+ * @var mixed
+ */
+ protected $operator = '>=';
+
+ /**
* Evaluates this condition with $value and returns true if $value is
greather than
* or equal to the reference value or false if not.
*
@@ -37,16 +42,5 @@
{
return $value >= $this->value;
}
-
- /**
- * Returns a textual representation of this condition.
- *
- * @return string
- * @ignore
- */
- public function __toString()
- {
- return '>= ' . $this->value;
- }
}
?>
Modified: trunk/Workflow/src/conditions/is_equal_or_less_than.php
==============================================================================
--- trunk/Workflow/src/conditions/is_equal_or_less_than.php [iso-8859-1]
(original)
+++ trunk/Workflow/src/conditions/is_equal_or_less_than.php [iso-8859-1] Fri
Aug 10 10:11:05 2007
@@ -26,6 +26,11 @@
class ezcWorkflowConditionIsEqualOrLessThan extends
ezcWorkflowConditionComparison
{
/**
+ * @var mixed
+ */
+ protected $operator = '<=';
+
+ /**
* Evaluates this condition with $value and returns true if $value is less
than
* or equal to the reference value or false if not.
*
@@ -37,16 +42,5 @@
{
return $value <= $this->value;
}
-
- /**
- * Returns a textual representation of this condition.
- *
- * @return string
- * @ignore
- */
- public function __toString()
- {
- return '<= ' . $this->value;
- }
}
?>
Modified: trunk/Workflow/src/conditions/is_greater_than.php
==============================================================================
--- trunk/Workflow/src/conditions/is_greater_than.php [iso-8859-1] (original)
+++ trunk/Workflow/src/conditions/is_greater_than.php [iso-8859-1] Fri Aug 10
10:11:05 2007
@@ -26,6 +26,11 @@
class ezcWorkflowConditionIsGreaterThan extends ezcWorkflowConditionComparison
{
/**
+ * @var mixed
+ */
+ protected $operator = '>';
+
+ /**
* Evaluates this condition with $value and returns true if $value is
greather than
* the reference value or false if not.
*
@@ -37,16 +42,5 @@
{
return $value > $this->value;
}
-
- /**
- * Returns a textual representation of this condition.
- *
- * @return string
- * @ignore
- */
- public function __toString()
- {
- return '> ' . $this->value;
- }
}
?>
Modified: trunk/Workflow/src/conditions/is_less_than.php
==============================================================================
--- trunk/Workflow/src/conditions/is_less_than.php [iso-8859-1] (original)
+++ trunk/Workflow/src/conditions/is_less_than.php [iso-8859-1] Fri Aug 10
10:11:05 2007
@@ -26,6 +26,11 @@
class ezcWorkflowConditionIsLessThan extends ezcWorkflowConditionComparison
{
/**
+ * @var mixed
+ */
+ protected $operator = '<';
+
+ /**
* Evaluates this condition with $value and returns true if $value is less
than
* the reference value or false if not.
*
@@ -37,16 +42,5 @@
{
return $value < $this->value;
}
-
- /**
- * Returns a textual representation of this condition.
- *
- * @return string
- * @ignore
- */
- public function __toString()
- {
- return '< ' . $this->value;
- }
}
?>
Modified: trunk/Workflow/src/conditions/is_not_equal.php
==============================================================================
--- trunk/Workflow/src/conditions/is_not_equal.php [iso-8859-1] (original)
+++ trunk/Workflow/src/conditions/is_not_equal.php [iso-8859-1] Fri Aug 10
10:11:05 2007
@@ -26,6 +26,11 @@
class ezcWorkflowConditionIsNotEqual extends ezcWorkflowConditionComparison
{
/**
+ * @var mixed
+ */
+ protected $operator = '!=';
+
+ /**
* Evaluates this condition with $value and returns true if it is false or
false if it is not.
*
* @param mixed $value
@@ -36,16 +41,5 @@
{
return $value != $this->value;
}
-
- /**
- * Returns a textual representation of this condition.
- *
- * @return string
- * @ignore
- */
- public function __toString()
- {
- return '!= ' . $this->value;
- }
}
?>
Modified: trunk/Workflow/src/interfaces/condition_comparison.php
==============================================================================
--- trunk/Workflow/src/interfaces/condition_comparison.php [iso-8859-1]
(original)
+++ trunk/Workflow/src/interfaces/condition_comparison.php [iso-8859-1] Fri Aug
10 10:11:05 2007
@@ -19,6 +19,11 @@
/**
* @var mixed
*/
+ protected $operator = '';
+
+ /**
+ * @var mixed
+ */
protected $value;
/**
@@ -28,7 +33,7 @@
*
* @param mixed $value
*/
- public function __construct( $value )
+ public function __construct( $value = null )
{
$this->value = $value;
}
@@ -43,5 +48,38 @@
{
return $this->value;
}
+
+ /**
+ * Sets the value that this condition compares against.
+ *
+ * @param mixed $value
+ * @ignore
+ */
+ public function setValue( $value )
+ {
+ $this->value = $value;
+ }
+
+ /**
+ * Returns the operator.
+ *
+ * @return string
+ * @ignore
+ */
+ public function getOperator()
+ {
+ return $this->operator;
+ }
+
+ /**
+ * Returns a textual representation of this condition.
+ *
+ * @return string
+ * @ignore
+ */
+ public function __toString()
+ {
+ return $this->operator . ' ' . $this->value;
+ }
}
?>
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components