public function __call($methodName, $args)
{
if ($this->alwaysValid === true) {
return $this;
}
if (!method_exists($this->assertionClassName, $methodName)) {
throw new \RuntimeException("Assertion '" . $methodName . "' does not exist.");
}
$reflClass = new ReflectionClass($this->assertionClassName);
$method = $reflClass->getMethod($methodName);
array_unshift($args, $this->value);
$params = $method->getParameters();
foreach ($params as $idx => $param) {
if (isset($args[$idx])) {
continue;
}
if ($param->getName() == 'message') {
$args[$idx] = $this->defaultMessage;
}
if ($param->getName() == 'propertyPath') {
$args[$idx] = $this->defaultPropertyPath;
}
}
if ($this->all) {
$methodName = 'all' . $methodName;
}
call_user_func_array(array($this->assertionClassName, $methodName), $args);
return $this;
}