/**
  * Get a valid response back
  *
  * @param String $type
  * @param String $origin
  * @return Response The response
  */
 private static function getResponse($type = 'application/javascript', $origin = '*')
 {
     $response = new Response();
     $date = new DateTime();
     $response->setCharset('UTF-8')->setDate($date)->setEtag(hash('sha512', microtime() . rand()))->setExpires($date)->setLastModified($date)->setMaxAge(0)->setPrivate()->header('Pragma', 'no-cache')->header('Access-Control-Allow-Origin', $origin ? $origin : '*')->header('Access-Control-Allow-Methods', 'POST, GET')->header('Access-Control-Allow-Credentials', 'true')->header('Content-Type', ($type ? $type : 'application/javascript') . '; charset=utf-8')->header('X-Frame-Options', 'deny')->setContent(json_encode(['error' => 1]));
     return $response;
 }