private function invokeFunction($function, $namedParams, $classParams)
    {
        $reflection = new \ReflectionFunction($function);
        $params = $reflection->getParameters();

        $invokeParams = $this->mapParameters($params, $namedParams, $classParams);

        return call_user_func_array($function, $invokeParams);
    }