*
* @author James Pepin <james@jamespepin.com>
*/
-class Horde_Constraint_And extends Horde_Constraint_Compound
+class Horde_Constraint_And extends Horde_Constraint_Coupler
{
public function evaluate($value)
{
+++ /dev/null
-<?php
-/**
- * Interface for compound constraints.
- *
- * @author James Pepin <james@jamespepin.com>
- */
-abstract class Horde_Constraint_Compound implements Horde_Constraint
-{
- protected $_constraints = array();
-
- public function __construct()
- {
- $constraints = func_get_args();
- foreach ($constraints as $c) {
- if (! $c instanceof Horde_Constraint) {
- throw new IllegalArgumentException("$c does not implement Horde_Constraint");
- }
- $this->addConstraint($c);
- }
- }
-
- public function addConstraint(Horde_Constraint $constraint)
- {
- $kind = get_class($this);
- if ($constrainst instanceof $kind) {
- foreach ($constrainst->getConstraints() as $c) {
- $this->addConstraint($c);
- }
- } else {
- $this->_constraints[] = $constraint;
- }
- return $this;
- }
-
- public function getConstraints()
- {
- return $this->_constraints;
- }
-}
--- /dev/null
+<?php
+/**
+ * Interface for grouped (compound, coupled) constraints.
+ *
+ * @author James Pepin <james@jamespepin.com>
+ */
+abstract class Horde_Constraint_Coupler implements Horde_Constraint
+{
+ protected $_constraints = array();
+
+ public function __construct()
+ {
+ $constraints = func_get_args();
+ foreach ($constraints as $c) {
+ if (! $c instanceof Horde_Constraint) {
+ throw new IllegalArgumentException("$c does not implement Horde_Constraint");
+ }
+ $this->addConstraint($c);
+ }
+ }
+
+ public function addConstraint(Horde_Constraint $constraint)
+ {
+ $kind = get_class($this);
+ if ($constrainst instanceof $kind) {
+ foreach ($constrainst->getConstraints() as $c) {
+ $this->addConstraint($c);
+ }
+ } else {
+ $this->_constraints[] = $constraint;
+ }
+ return $this;
+ }
+
+ public function getConstraints()
+ {
+ return $this->_constraints;
+ }
+}
* @author James Pepin <james@jamespepin.com>
* @author Chuck Hagenbuch <chuck@horde.org>
*/
-class Horde_Constraint_Or extends Horde_Constraint_Compound
+class Horde_Constraint_Or extends Horde_Constraint_Coupler
{
public function evaluate($value)
{
<file name="AlwaysFalse.php" role="php" />
<file name="AlwaysTrue.php" role="php" />
<file name="And.php" role="php" />
- <file name="Compound.php" role="php" />
+ <file name="Coupler.php" role="php" />
<file name="IsEqual.php" role="php" />
<file name="IsInstanceOf.php" role="php" />
<file name="Not.php" role="php" />
<install name="lib/Horde/Constraint/AlwaysFalse.php" as="Horde/Constraint/AlwaysFalse.php" />
<install name="lib/Horde/Constraint/AlwaysTrue.php" as="Horde/Constraint/AlwaysTrue.php" />
<install name="lib/Horde/Constraint/And.php" as="Horde/Constraint/And.php" />
- <install name="lib/Horde/Constraint/Compound.php" as="Horde/Constraint/Compound.php" />
+ <install name="lib/Horde/Constraint/Coupler.php" as="Horde/Constraint/Coupler.php" />
<install name="lib/Horde/Constraint/IsEqual.php" as="Horde/Constraint/IsEqual.php" />
<install name="lib/Horde/Constraint/IsInstanceOf.php" as="Horde/Constraint/IsInstanceOf.php" />
<install name="lib/Horde/Constraint/Not.php" as="Horde/Constraint/Not.php" />