Rename Horde_Constraint_Compound to Horde_Constraint_Coupler
authorChuck Hagenbuch <chuck@horde.org>
Mon, 28 Sep 2009 18:46:19 +0000 (14:46 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Mon, 28 Sep 2009 18:55:09 +0000 (14:55 -0400)
framework/Constraint/lib/Horde/Constraint/And.php
framework/Constraint/lib/Horde/Constraint/Compound.php [deleted file]
framework/Constraint/lib/Horde/Constraint/Coupler.php [new file with mode: 0644]
framework/Constraint/lib/Horde/Constraint/Or.php
framework/Constraint/package.xml

index 2f199a4..a061dff 100644 (file)
@@ -7,7 +7,7 @@
  *
  * @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)
     {
diff --git a/framework/Constraint/lib/Horde/Constraint/Compound.php b/framework/Constraint/lib/Horde/Constraint/Compound.php
deleted file mode 100644 (file)
index a74624d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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;
-    }
-}
diff --git a/framework/Constraint/lib/Horde/Constraint/Coupler.php b/framework/Constraint/lib/Horde/Constraint/Coupler.php
new file mode 100644 (file)
index 0000000..514a7fd
--- /dev/null
@@ -0,0 +1,39 @@
+<?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;
+    }
+}
index 0882fed..8be773d 100644 (file)
@@ -5,7 +5,7 @@
  * @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)
     {
index f070797..9622a17 100644 (file)
@@ -40,7 +40,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
       <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" />
@@ -68,7 +68,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <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" />