Esempio n. 1
0
 public function __construct($uri)
 {
     parent::__construct();
     $this->uri = Uri::create($uri);
     if (!$this->uri->isAbsolute()) {
         FrameworkRuntimeError::create('Redirect URI must be absolute, "%s" is given', null, $this->uri->toString())->_throw();
     }
 }
Esempio n. 2
0
 /**
  * @return $this
  */
 public static function createFromGlobals()
 {
     $serverName = $_SERVER['SERVER_NAME'];
     $scheme = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http';
     $uriString = $scheme . '://' . $serverName . $_SERVER['REQUEST_URI'];
     $request = new static();
     $request->setServerName($serverName)->setPort($_SERVER['SERVER_PORT'])->setUserAgent($_SERVER['HTTP_USER_AGENT'])->setRemoteAddr($_SERVER['REMOTE_ADDR'])->setRemotePort($_SERVER['REMOTE_PORT'])->setMethod($_SERVER['REQUEST_METHOD'])->setUri(Uri::create($uriString))->setHttpReferer(@$_SERVER['HTTP_REFERER'])->setGetInput(Input::createFromArray($_GET))->setCookieInput(Input::createFromArray($_COOKIE))->setPostInput(Input::createFromArray($_POST));
     return $request;
 }
Esempio n. 3
0
 /**
  * @return string
  */
 public function getBaseUri()
 {
     return $this->requestUri->makeBaseUri()->toString();
 }