public function run() { $module = $_GET["act"]; $action = $_GET["method"]; // TODO: can do some filter here $dispatcher = new RequestDispatcher($this, $module, $action); $dispatcher->dispatch(); }
/** * @param $verb * @param $resource * @param array $data * * @return mixed * @throws RequestValidationException * @throws UserNotAuthorizedException */ protected function getResponse($verb, $resource, array $data = array()) { $dispatcher = new RequestDispatcher(); $request = new Request($resource); $this->setRequestHeaders($request); $this->prepareRequest($verb, $data, $request); $dispatcher->add($request); $dispatcher->execute(); $responses = $this->getRequestContent($dispatcher); $this->checkResponseForErrors($responses); return json_decode($responses[0]->getContent()); }