Sfoglia il codice sorgente

[RequestHandler] added getPort() and setMethod() to Request

Fabien Potencier 15 anni fa
parent
commit
038f7d7bb4
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. 11 0
      src/Symfony/Components/RequestHandler/Request.php

+ 11 - 0
src/Symfony/Components/RequestHandler/Request.php

@@ -238,6 +238,11 @@ class Request
     return ($this->server->get('HTTPS') == 'on') ? 'https' : 'http';
   }
 
+  public function getPort()
+  {
+    return $this->server->get('SERVER_PORT');
+  }
+
   public function getHttpHost()
   {
     $host = $this->headers->get('HOST');
@@ -300,6 +305,12 @@ class Request
     }
   }
 
+  public function setMethod($method)
+  {
+    $this->method = null;
+    $this->server->set('REQUEST_METHOD', 'GET');
+  }
+
   /**
    * Gets the request method.
    *