Is this a reliable way to check the REQUEST_METHOD?
<p>In my class, <code>AController</code>, I have the following method:</p>

<pre><code>private function determineRequestMethod()
{
  if($_SERVER['REQUEST_METHOD'] == 'POST')
  {
    $this-&gt;requestMethod = AController::POST;
  }
  else
  {
    $this-&gt;requestMethod = AController::GET;
  }
}
</code></pre>

<p>This method is called from the constructor. <code>POST</code> and <code>GET</code> are class constants, and <code>requestMethod</code> is a class variable.</p>

<p>PS - <code>$_SERVER['REQUEST_METHOD']</code> does work on my server.</p>

<p>I have updated the method to specifically check for <code>GET</code> and to throw an exception when the request method is not <code>GET</code> or <code>POST</code>:</p>

<pre><code>private function determineRequestMethod()
{
    if($_SERVER['REQUEST_METHOD'] == AController::POST) 
    {
        $this-&gt;requestMethod = AController::POST;
    } 
    else if($_SERVER['REQUEST_METHOD'] == AController::GET)
    {
        $this-&gt;requestMethod = AController::GET;
    }
    else
    {
        throw new Exception('Unexpected request method [' . $_SERVER['REQUEST_METHOD'] . '].');
    }
}
</code></pre>
