lithium\test\Mocker::_methodParams()

protected static method

Will determine what parameter prototype of a method.

For instance: 'ReflectionFunctionAbstract $method' or '$name, array $foo = null'

Parameters

  • ReflectionFunctionAbstract $method

Returns

string

Source

	protected static function _methodParams(ReflectionFunctionAbstract $method) {
		$pattern = '/Parameter #[0-9]+ \[ [^\>]+>([^\]]+) \]/';
		$replace = [
			'from' => [' Array', 'or NULL'],
			'to' => [' array()', ''],
		];
		preg_match_all($pattern, $method, $matches);
		$params = implode(', ', $matches[1]);
		return str_replace($replace['from'], $replace['to'], $params);
	}