/**
  * Build the request object
  * @return Request
  */
 protected function _buildRequest($uri = null)
 {
     $request = new Request();
     $request->setURI(!$uri ? $this->_getServerURI() : $uri);
     $jsonBody = json_decode(file_get_contents("php://input"), true);
     if ($jsonBody !== false) {
         //set request body
         $request->setJson(new Request\Json($jsonBody));
     }
     $server = new Request\Server($_SERVER);
     $post = new Request\Post($_POST);
     $get = new Request\Get($_GET);
     $files = new Request\Files($_FILES);
     $request->setServer($server);
     $request->setPost($post);
     $request->setGet($get);
     $request->setFiles($files);
     return $request;
 }
Beispiel #2
0
 /**
  * Call the given version and method
  * @param string $api_version
  * @param string $api_method
  * @param Request $request
  * @return type
  */
 public static function call($api_version, $api_method, Request $request)
 {
     $request_method = strtolower($request->getServer()->get('REQUEST_METHOD'));
     return self::$methods[$request_method][$api_method]->call($api_version, $request);
 }