Author: Anton Shevchuk
Inheritance: extends Zend\Diactoros\ServerRequestFactory
Exemple #1
0
 /**
  * get CLI Request
  * @return void
  * @throws ApplicationException
  */
 public function initRequest()
 {
     $arguments = getopt("u:", ["uri:"]);
     if (!array_key_exists('u', $arguments) && !array_key_exists('uri', $arguments)) {
         throw new ApplicationException('Attribute `--uri` is required');
     }
     $uri = $arguments['u'] ?? $arguments['uri'];
     $request = RequestFactory::fromGlobals(['REQUEST_URI' => $uri, 'REQUEST_METHOD' => 'CLI']);
     Request::setInstance($request);
 }
Exemple #2
0
 /**
  * Reset layout and Request
  */
 protected static function resetApp()
 {
     if (self::$app) {
         self::$app->useLayout(true);
         self::$app->resetRouter();
     }
     Proxy\Auth::clearIdentity();
     Proxy\Messages::popAll();
     Proxy\Request::setInstance(RequestFactory::fromGlobals());
     Proxy\Response::setInstance(new Bluz\Response\Response());
 }
Exemple #3
0
 /**
  * Initial Request instance
  *
  * @return void
  */
 protected function initRequest()
 {
     $request = RequestFactory::fromGlobals();
     Request::setInstance($request);
 }
Exemple #4
0
 /**
  * Get uploaded file
  *
  * @param  string $name
  * @return \Zend\Diactoros\UploadedFile
  */
 public static function getFile($name)
 {
     return RequestFactory::get($name, self::getInstance()->getUploadedFiles());
 }