private function getOptionResponse(GraphRequest $request)
 {
     $res = new GraphResponse();
     $res->setStatusCode(200);
     $res->setHeader('allow', 'HEAD,GET,POST,PUT,PATCH,DELETE,OPTIONS');
     return $res;
 }
 private function parseResponse($str)
 {
     $res = new GraphResponse();
     $schema = explode("\r\n\r\n", $str);
     $res->setBody($schema[1]);
     $status = explode(' ', explode("\n", $schema[0])[0])[1];
     $res->setStatusCode($status);
     $headers = explode("\n", $schema[0]);
     unset($headers[0]);
     foreach ($headers as $h) {
         $kv = explode(':', $h);
         $res->setHeader($kv[0], $kv[1]);
     }
     return $res;
 }
 /**
  * Crea una risposta sicura (Modulo non trovato se non e pervenuta una
  * risposta)
  *
  * @param  GraphResponse | null $response
  * @return GraphResponse
  */
 private function getSafeResponse($response)
 {
     $filterManager = Graphene::getInstance()->getFilterManager();
     if ($response === null) {
         $response = new GraphResponse();
         $response->setHeader('content-type', 'application/json');
         if ($filterManager->haveErrors()) {
             $response->setBody($filterManager->serializeErrors());
             $ff = $filterManager->getFailedFilter();
             $response->setBody(json_encode(array("error" => array("message" => '[' . $ff['name'] . '] ' . $ff['message'], "code" => $ff['status'])), JSON_PRETTY_PRINT));
             $response->setStatusCode($ff['status']);
         } else {
             $response->setBody(json_encode(array("error" => array("message" => "action not found", "code" => "400")), JSON_PRETTY_PRINT));
             $response->setStatusCode(400);
         }
     }
     return $response;
 }