lithium\core\StaticObject::invokeMethod PHP Method

invokeMethod() public static method

Calls a method on this object with the given parameters. Provides an OO wrapper for forward_static_call_array(), and improves performance by using straight method calls in most cases.
public static invokeMethod ( string $method, array $params = [] ) : mixed
$method string Name of the method to call.
$params array Parameter list to use when calling `$method`.
return mixed Returns the result of the method call.
    public static function invokeMethod($method, $params = array())
    {
        switch (count($params)) {
            case 0:
                return static::$method();
            case 1:
                return static::$method($params[0]);
            case 2:
                return static::$method($params[0], $params[1]);
            case 3:
                return static::$method($params[0], $params[1], $params[2]);
            case 4:
                return static::$method($params[0], $params[1], $params[2], $params[3]);
            case 5:
                return static::$method($params[0], $params[1], $params[2], $params[3], $params[4]);
            default:
                return forward_static_call_array(array(get_called_class(), $method), $params);
        }
    }