Overview

Classes

  • Horde_Constraint_AlwaysFalse
  • Horde_Constraint_AlwaysTrue
  • Horde_Constraint_And
  • Horde_Constraint_Coupler
  • Horde_Constraint_IsEqual
  • Horde_Constraint_IsInstanceOf
  • Horde_Constraint_Not
  • Horde_Constraint_Null
  • Horde_Constraint_Or
  • Horde_Constraint_PregMatch

Interfaces

  • Horde_Constraint
  • Overview
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Interface for grouped (compound, coupled) constraints.
 4:  *
 5:  * @author James Pepin <james@jamespepin.com>
 6:  */
 7: abstract class Horde_Constraint_Coupler implements Horde_Constraint
 8: {
 9:     protected $_constraints = array();
10: 
11:     public function __construct()
12:     {
13:         $constraints = func_get_args();
14:         foreach ($constraints as $c) {
15:             if (! $c instanceof Horde_Constraint) {
16:                 throw new IllegalArgumentException("$c does not implement Horde_Constraint");
17:             }
18:             $this->addConstraint($c);
19:         }
20:     }
21: 
22:     public function addConstraint(Horde_Constraint $constraint)
23:     {
24:         $kind = get_class($this);
25:         if ($constraint instanceof $kind) {
26:             foreach ($constraint->getConstraints() as $c) {
27:                 $this->addConstraint($c);
28:             }
29:         } else {
30:             $this->_constraints[] = $constraint;
31:         }
32:         return $this;
33:     }
34: 
35:     public function getConstraints()
36:     {
37:         return $this->_constraints;
38:     }
39: }
40: 
API documentation generated by ApiGen