original_string: public static function fromGlobals()
      {
          $request = new self();
  
          foreach ([
              'Accept', 'Accept-Charset', 'Accept-Encoding', 'Accept-Language',
              'Connection', 'Host', 'Referer', 'User-Agent'
          ] as $name) {
              $key = 'HTTP_' . str_replace('-', '_', strtoupper($name));
              if (isset($_SERVER[$key])) {
                  $request->setHeader($name, $_SERVER[$key], false);
              }
          }
  
          $request->_isSecure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off');
  
          $request->_method = $_SERVER['REQUEST_METHOD'];
          $request->_uri = $_SERVER['REQUEST_URI'];
  
          $request->_path = strstr($_SERVER['REQUEST_URI'], '?', true);
          if ($request->_path == false) {
              $request->_path = $_SERVER['REQUEST_URI'];
          }
          $request->_query = strstr($_SERVER['REQUEST_URI'], '?');
          if ($request->_query == false) {
              $request->_query = '';
          }
  
          return $request;
      }
code: public static function fromGlobals()
      {
          $request = new self();
  
          foreach ([
              'Accept', 'Accept-Charset', 'Accept-Encoding', 'Accept-Language',
              'Connection', 'Host', 'Referer', 'User-Agent'
          ] as $name) {
              $key = 'HTTP_' . str_replace('-', '_', strtoupper($name));
              if (isset($_SERVER[$key])) {
                  $request->setHeader($name, $_SERVER[$key], false);
              }
          }
  
          $request->_isSecure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off');
  
          $request->_method = $_SERVER['REQUEST_METHOD'];
          $request->_uri = $_SERVER['REQUEST_URI'];
  
          $request->_path = strstr($_SERVER['REQUEST_URI'], '?', true);
          if ($request->_path == false) {
              $request->_path = $_SERVER['REQUEST_URI'];
          }
          $request->_query = strstr($_SERVER['REQUEST_URI'], '?');
          if ($request->_query == false) {
              $request->_query = '';
          }
  
          return $request;
      }
code_tokens: public static function fromGlobals ( ) { $ request = new self ( ) ; foreach ( [ 'Accept' , 'Accept-Charset' , 'Accept-Encoding' , 'Accept-Language' , 'Connection' , 'Host' , 'Referer' , 'User-Agent' ] as $ name ) { $ key = 'HTTP_' . str_replace ( '-' , '_' , strtoupper ( $ name ) ) ; if ( isset ( $ _SERVER [ $ key ] ) ) { $ request -> setHeader ( $ name , $ _SERVER [ $ key ] , false ) ; } } $ request -> _isSecure = ( ! empty ( $ _SERVER [ 'HTTPS' ] ) && $ _SERVER [ 'HTTPS' ] != 'off' ) ; $ request -> _method = $ _SERVER [ 'REQUEST_METHOD' ] ; $ request -> _uri = $ _SERVER [ 'REQUEST_URI' ] ; $ request -> _path = strstr ( $ _SERVER [ 'REQUEST_URI' ] , '?' , true ) ; if ( $ request -> _path == false ) { $ request -> _path = $ _SERVER [ 'REQUEST_URI' ] ; } $ request -> _query = strstr ( $ _SERVER [ 'REQUEST_URI' ] , '?' ) ; if ( $ request -> _query == false ) { $ request -> _query = '' ; } return $ request ; }
docstring: Create request from PHP globals.
docstring_tokens: Create request from PHP globals .