Exemplo n.º 1
0
 /**
  * Performs basic request validation.
  *
  * Will setup an error response if necessary.
  *
  * @return  bool
  */
 private function validateRequest()
 {
     $method = $_SERVER['REQUEST_METHOD'] ?? 'INVALID';
     if ('POST' !== $method) {
         $this->response = new Response();
         $this->response->setResponseCode(405);
         return false;
     }
     if (null === $this->request) {
         $this->response = new Response();
         $this->response->setResponseCode(400);
         return false;
     }
     return true;
 }