/** * \virtual * @param string $methodName * @param array $args */ public function call($methodName, $args = array()) { $this->spiritEngine->setActiveInstance($this->_activeInstanceId); http::freeze(); //a Spirit Cannot send any HTTP Header unless It is used as ResponseService. as the spirit output is embedded in the app output. so its the app that sends the header. not the spirit $this->spiritEngine->run($this->spiritName, $methodName, $args); http::release(); //Engine Automatically Clear's the Active Instance Id So no need to call clear Explecitely return $this->spiritEngine->response(); }
public function executeLogic() { require_once $this->model($__i_dmp); $modelName = $this->modelName(); $modelReflection = new ReflectionClass($modelName); $model = $modelReflection->newInstance(); $controller = null; if (isset($this->navigation->controllerName)) { require $this->controller(); $controllerName = ucfirst($this->navigation->controllerName . 'Controller'); $controllerReflection = new ReflectionClass($controllerName); $controller = $controllerReflection->newInstanceArgs(array($model)); if (isset($this->navigation->controllerMethodName)) { $controllerReflectionObject = new ReflectionObject($controller); try { $methodReflection = $controllerReflectionObject->getMethod($this->navigation->controllerMethodName); } catch (ReflectionException $ex) { throw new MethodNotFoundException($this->navigation->controllerMethodName, $this->navigation->controllerName, $this->projectName); } if ($methodReflection) { $methodReflection->invokeArgs($controller, $this->navigation->controllerMethodArgs); } } } $spiritEngine = new SpiritEngine($controller); if (isset($this->navigation->spiritInstanceId)) { $spiritEngine->setActiveInstance($this->navigation->spiritInstanceId); } $spiritEngine->spirit($this->navigation->spiritName); if (isset($this->navigation->spiritInstanceId)) { $spiritEngine->setActiveInstance($this->navigation->spiritInstanceId); } if ($this->navigation->methodName) { $this->responseBuffer = $spiritEngine->run($this->navigation->spiritName, $this->navigation->methodName, $this->navigation->args); } $this->storeXDO($spiritEngine->xdo()); return $spiritEngine; }