Handling server request method
<?php
/**
* Handles flow of control based on request type.
* @return void
*/
public function requestDispatcher()
{
/**
* first time page load
*/
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
if (filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) === null)
{
$this->generateView();
return;
} else {
$this->handleGET();
}
}
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
$this->handleGET();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST')
{
$this->handlePOST();
}
}