LaravelRequest.php 828 B

123456789101112131415161718192021222324252627
  1. <?php namespace Symfony\Component\HttpFoundation;
  2. class LaravelRequest extends Request {
  3. /**
  4. * Creates a new request with values from PHP's super globals.
  5. *
  6. * @return Request A new request
  7. *
  8. * @api
  9. */
  10. static public function createFromGlobals()
  11. {
  12. $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
  13. if (0 === strpos($request->server->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
  14. && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))
  15. ) {
  16. parse_str($request->getContent(), $data);
  17. if (magic_quotes()) $data = array_strip_slashes($data);
  18. $request->request = new ParameterBag($data);
  19. }
  20. return $request;
  21. }
  22. }