lithium\test\Mocker::_methodParams()
Will determine what parameter prototype of a method.
For instance: 'ReflectionFunctionAbstract $method' or '$name, array $foo = null'
Parameters
-
ReflectionFunctionAbstract
$method
Returns
stringSource
protected static function _methodParams(ReflectionFunctionAbstract $method) {
$pattern = '/Parameter #[0-9]+ \[ [^\>]+>([^\]]+) \]/';
$replace = array(
'from' => array(' Array', 'or NULL'),
'to' => array(' array()', ''),
);
preg_match_all($pattern, $method, $matches);
$params = implode(', ', $matches[1]);
return str_replace($replace['from'], $replace['to'], $params);
}