fromAll() public static method

public static fromAll ( $constraints )
Example #1
0
 /**
  * Examples of calls:
  * when($constraint1, $constraint2, ..., $constraintN)
  * when(callable $takesNArguments)
  * when(Antecedent $antecedent)
  * @return self
  */
 public function when()
 {
     $arguments = func_get_args();
     if ($arguments[0] instanceof Antecedent) {
         $antecedent = $arguments[0];
     } elseif ($arguments[0] instanceof PHPUnit_Framework_Constraint) {
         $antecedent = Antecedent\IndependentConstraintsAntecedent::fromAll($arguments);
     } elseif ($arguments && count($arguments) == 1) {
         $antecedent = Antecedent\SingleCallbackAntecedent::from($arguments[0]);
     } else {
         throw new \InvalidArgumentException("Invalid call to when(): " . var_export($arguments, true));
     }
     $this->antecedents[] = $antecedent;
     return $this;
 }