ApacheRequest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpFoundation;
  11. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ApacheRequest::class, Request::class), \E_USER_DEPRECATED);
  12. /**
  13. * Request represents an HTTP request from an Apache server.
  14. *
  15. * @deprecated since Symfony 4.4. Use the Request class instead.
  16. *
  17. * @author Fabien Potencier <fabien@symfony.com>
  18. */
  19. class ApacheRequest extends Request
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. protected function prepareRequestUri()
  25. {
  26. return $this->server->get('REQUEST_URI');
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. protected function prepareBaseUrl()
  32. {
  33. $baseUrl = $this->server->get('SCRIPT_NAME');
  34. if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) {
  35. // assume mod_rewrite
  36. return rtrim(\dirname($baseUrl), '/\\');
  37. }
  38. return $baseUrl;
  39. }
  40. }