original_string: public function redirect($url, $view = false)
      {
          if ($view === false && !preg_match('#^https?\://#i', $url)) {
              $_url = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
              $start = substr($url, 0, 1);
  
              if (!empty($start)) {
                  if ($start === '?') {
                      $_url .= str_replace('?' . $_SERVER['QUERY_STRING'], '', $_SERVER['REQUEST_URI']);
                  } elseif ($start !== '/') {
                      $_url .= '/';
                  }
              }
              $_url .= $url;
          } else {
              $_url = $url;
          }
  
          $this->last_selector = null;
  
          if ($view !== false) {
              return $this->reset_response()->cmd(8, array(
                  $_url,
                  $view
              ));
          } else {
              return $this->cmd(8, array(
                  $_url,
                  false
              ));
          }
      }
code: public function redirect($url, $view = false)
      {
          if ($view === false && !preg_match('#^https?\://#i', $url)) {
              $_url = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
              $start = substr($url, 0, 1);
  
              if (!empty($start)) {
                  if ($start === '?') {
                      $_url .= str_replace('?' . $_SERVER['QUERY_STRING'], '', $_SERVER['REQUEST_URI']);
                  } elseif ($start !== '/') {
                      $_url .= '/';
                  }
              }
              $_url .= $url;
          } else {
              $_url = $url;
          }
  
          $this->last_selector = null;
  
          if ($view !== false) {
              return $this->reset_response()->cmd(8, array(
                  $_url,
                  $view
              ));
          } else {
              return $this->cmd(8, array(
                  $_url,
                  false
              ));
          }
      }
code_tokens: public function redirect ( $ url , $ view = false ) { if ( $ view === false && ! preg_match ( '#^https?\://#i' , $ url ) ) { $ _url = ( empty ( $ _SERVER [ 'HTTPS' ] ) || $ _SERVER [ 'HTTPS' ] === 'off' ? 'http://' : 'https://' ) . $ _SERVER [ 'HTTP_HOST' ] ; $ start = substr ( $ url , 0 , 1 ) ; if ( ! empty ( $ start ) ) { if ( $ start === '?' ) { $ _url .= str_replace ( '?' . $ _SERVER [ 'QUERY_STRING' ] , '' , $ _SERVER [ 'REQUEST_URI' ] ) ; } elseif ( $ start !== '/' ) { $ _url .= '/' ; } } $ _url .= $ url ; } else { $ _url = $ url ; } $ this -> last_selector = null ; if ( $ view !== false ) { return $ this -> reset_response ( ) -> cmd ( 8 , array ( $ _url , $ view ) ) ; } else { return $ this -> cmd ( 8 , array ( $ _url , false ) ) ; } }
docstring: Creates a redirect
  
  @param string $url Complete url with http:// (according to W3 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30)
  @param bool|string $view Internal means that phery will cancel the
  current DOM manipulation and commands and will issue another
  phery.remote to the location in url, useful if your PHP code is
  issuing redirects but you are using AJAX views.
  Passing false will issue a browser redirect
  
  @return PheryResponse
docstring_tokens: Creates a redirect