WebProcessor.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  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\Bridge\Monolog\Processor;
  11. use Monolog\Processor\WebProcessor as BaseWebProcessor;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpKernel\Event\GetResponseEvent;
  14. use Symfony\Component\HttpKernel\HttpKernelInterface;
  15. /**
  16. * WebProcessor override to read from the HttpFoundation's Request
  17. *
  18. * @author Jordi Boggiano <j.boggiano@seld.be>
  19. */
  20. class WebProcessor extends BaseWebProcessor
  21. {
  22. public function __construct()
  23. {
  24. // Pass an empty array as the default null value would access $_SERVER
  25. parent::__construct(array());
  26. }
  27. public function onKernelRequest(GetResponseEvent $event)
  28. {
  29. if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
  30. $this->serverData = $event->getRequest()->server->all();
  31. }
  32. }
  33. }