public static function __callStatic($method, $args)
{
if (strpos($method, "nullOr") === 0) {
if (!array_key_exists(0, $args)) {
throw new BadMethodCallException("Missing the first argument.");
}
if ($args[0] === null) {
return true;
}
$method = substr($method, 6);
return call_user_func_array(array(get_called_class(), $method), $args);
}
if (strpos($method, "all") === 0) {
if (!array_key_exists(0, $args)) {
throw new BadMethodCallException("Missing the first argument.");
}
static::isTraversable($args[0]);
$method = substr($method, 3);
$values = array_shift($args);
$calledClass = get_called_class();
foreach ($values as $value) {
call_user_func_array(array($calledClass, $method), array_merge(array($value), $args));
}
return true;
}
throw new BadMethodCallException("No assertion Assertion#" . $method . " exists.");
}