Example #1
0
 public function accepts(Argument $argument)
 {
     if (!$argument instanceof ExactArgument) {
         return false;
     }
     $value = $argument->value();
     if (is_array($value)) {
         return in_array($this->needle, $value);
     } else {
         if (is_string($value)) {
             return strpos($value, $this->needle) !== false;
         } else {
             if (is_object($value)) {
                 foreach ($value as $item) {
                     if ($item == $this->needle) {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }
Example #2
0
 /**
  * Determine whether an argument is optional
  *
  * @param Argument $argument
  *
  * @return bool
  */
 protected function noValue($argument)
 {
     return is_null($argument->value());
 }
Example #3
0
 public function accepts(Argument $argument)
 {
     return $argument instanceof StringArgument || $argument instanceof ExactArgument && is_string($argument->value());
 }
Example #4
0
 public function accepts(Argument $argument)
 {
     return $argument instanceof ExactArgument && is_a($argument->value(), $this->class) || $argument instanceof ObjectArgument && $argument->class == $this->class || $argument instanceof ObjectArgument && is_subclass_of($argument->class, $this->class);
 }
Example #5
0
 public function accepts(Argument $argument)
 {
     return $argument instanceof BooleanArgument || $argument instanceof ExactArgument && is_bool($argument->value());
 }
 public function accepts(Argument $argument)
 {
     return $argument instanceof RegularExpressionArgument && $argument->expression == $this->expression || $argument instanceof ExactArgument && preg_match($this->expression, $argument->value()) === 1;
 }
Example #7
0
 public function accepts(Argument $argument)
 {
     return $argument instanceof IntegerArgument || $argument instanceof ExactArgument && is_int($argument->value());
 }