[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/http-kernel/Event/ -> GetResponseForExceptionEvent.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\HttpKernel\Event;
  13  
  14  use Symfony\Component\HttpFoundation\Request;
  15  use Symfony\Component\HttpKernel\HttpKernelInterface;
  16  
  17  /**
  18   * Allows to create a response for a thrown exception.
  19   *
  20   * Call setResponse() to set the response that will be returned for the
  21   * current request. The propagation of this event is stopped as soon as a
  22   * response is set.
  23   *
  24   * You can also call setException() to replace the thrown exception. This
  25   * exception will be thrown if no response is set during processing of this
  26   * event.
  27   *
  28   * @author Bernhard Schussek <bschussek@gmail.com>
  29   */
  30  class GetResponseForExceptionEvent extends GetResponseEvent
  31  {
  32      /**
  33       * The exception object.
  34       *
  35       * @var \Exception
  36       */
  37      private $exception;
  38  
  39      public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, \Exception $e)
  40      {
  41          parent::__construct($kernel, $request, $requestType);
  42  
  43          $this->setException($e);
  44      }
  45  
  46      /**
  47       * Returns the thrown exception.
  48       *
  49       * @return \Exception The thrown exception
  50       */
  51      public function getException()
  52      {
  53          return $this->exception;
  54      }
  55  
  56      /**
  57       * Replaces the thrown exception.
  58       *
  59       * This exception will be thrown if no response is set in the event.
  60       *
  61       * @param \Exception $exception The thrown exception
  62       */
  63      public function setException(\Exception $exception)
  64      {
  65          $this->exception = $exception;
  66      }
  67  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1