public function methods($name = [])
{
if (!func_num_args()) {
return $this->_methods;
}
foreach ($name as $method => $returns) {
if (is_callable($returns)) {
$this->method($method, $returns);
} elseif (is_array($returns)) {
$stub = $this->method($method);
call_user_func_array([$stub, 'andReturn'], $returns);
} else {
$error = "Stubbed method definition for `{$method}` must be a closure or an array of returned value(s).";
throw new InvalidArgumentException($error);
}
}
}