/** * Dispatch method * * @param Method\Definition $invocable * @param array $params * @return mixed */ protected function _dispatch(Method\Definition $invocable, array $params) { $callback = $invocable->getCallback(); $type = $callback->getType(); if ('function' == $type) { $function = $callback->getFunction(); return call_user_func_array($function, $params); } $class = $callback->getClass(); $method = $callback->getMethod(); if ('static' == $type) { return call_user_func_array(array($class, $method), $params); } $object = $invocable->getObject(); if (!is_object($object)) { $invokeArgs = $invocable->getInvokeArguments(); if (!empty($invokeArgs)) { $reflection = new ReflectionClass($class); $object = $reflection->newInstanceArgs($invokeArgs); } else { $object = new $class(); } } return call_user_func_array(array($object, $method), $params); }
/** * (non-PHPdoc). * * @see \Zend\Server\AbstractServer::_dispatch() */ public function _dispatch(\Zend\Server\Method\Definition $invocable, array $params) { return call_user_func_array(array($this->container->get($invocable->getNameSm()), $invocable->getCallback()->getMethod()), $params); }