function __call($called, $args)
{
$count = 0;
foreach (Phockito::$_call_list as $call) {
if ($call['instance'] == $this->instance && $call['method'] == $called && Phockito::_arguments_match($this->class, $called, $args, $call['args'])) {
$count++;
}
}
if (preg_match('/([0-9]+)\\+/', $this->times, $match)) {
if ($count >= (int) $match[1]) {
return;
}
} else {
if ($count == $this->times) {
return;
}
}
$message = "Failed asserting that method {$called} was called {$this->times} times - actually called {$count} times.\n";
$message .= "Wanted call:\n";
$message .= print_r($args, true);
$message .= "Calls:\n";
foreach (Phockito::$_call_list as $call) {
if ($call['instance'] == $this->instance && $call['method'] == $called) {
$message .= print_r($call['args'], true);
}
}
$exceptionClass = self::$exception_class;
throw new $exceptionClass($message);
}