Example #1
0
 public static function fromRaw($body, $headers)
 {
     $out = new self();
     $out->setBody($body);
     $out->setHeaders($headers);
     $out->parseData();
     return $out;
 }
Example #2
0
 /**
  * @return Request
  */
 public static function fromInput()
 {
     global $module;
     $model = new self();
     $model->setMethod(self::getMethodFromInput());
     if (isset($module)) {
         $model->setPath($module);
         $input = explode('/', $module);
         $model->setSegments($input);
     }
     $model->setBody(InputStream::getInput());
     $model->setHeaders(self::getHeadersFromInput());
     $model->setParameters($_GET);
     $model->setCookies($_COOKIE);
     $model->setPost($_POST);
     $model->setEnvironment($_SERVER);
     $model->setStatus(http_response_code());
     $model->setUrl(self::getCurrentUri());
     $model->parseData();
     return $model;
 }