From: Chuck Hagenbuch Date: Mon, 28 Sep 2009 18:46:19 +0000 (-0400) Subject: Rename Horde_Constraint_Compound to Horde_Constraint_Coupler X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a9cf499da11faa6f0eb387716d4c0b3864d3dda7;p=horde.git Rename Horde_Constraint_Compound to Horde_Constraint_Coupler --- diff --git a/framework/Constraint/lib/Horde/Constraint/And.php b/framework/Constraint/lib/Horde/Constraint/And.php index 2f199a44d..a061dff3f 100644 --- a/framework/Constraint/lib/Horde/Constraint/And.php +++ b/framework/Constraint/lib/Horde/Constraint/And.php @@ -7,7 +7,7 @@ * * @author James Pepin */ -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 index a74624d7d..000000000 --- a/framework/Constraint/lib/Horde/Constraint/Compound.php +++ /dev/null @@ -1,39 +0,0 @@ - - */ -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 index 000000000..514a7fd99 --- /dev/null +++ b/framework/Constraint/lib/Horde/Constraint/Coupler.php @@ -0,0 +1,39 @@ + + */ +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; + } +} diff --git a/framework/Constraint/lib/Horde/Constraint/Or.php b/framework/Constraint/lib/Horde/Constraint/Or.php index 0882fedcd..8be773d9c 100644 --- a/framework/Constraint/lib/Horde/Constraint/Or.php +++ b/framework/Constraint/lib/Horde/Constraint/Or.php @@ -5,7 +5,7 @@ * @author James Pepin * @author Chuck Hagenbuch */ -class Horde_Constraint_Or extends Horde_Constraint_Compound +class Horde_Constraint_Or extends Horde_Constraint_Coupler { public function evaluate($value) { diff --git a/framework/Constraint/package.xml b/framework/Constraint/package.xml index f07079797..9622a17cf 100644 --- a/framework/Constraint/package.xml +++ b/framework/Constraint/package.xml @@ -40,7 +40,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + @@ -68,7 +68,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - +