[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/symfony/http-kernel/DataCollector/ -> ExceptionDataCollector.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\DataCollector;
  13  
  14  use Symfony\Component\Debug\Exception\FlattenException;
  15  use Symfony\Component\HttpFoundation\Request;
  16  use Symfony\Component\HttpFoundation\Response;
  17  
  18  /**
  19   * ExceptionDataCollector.
  20   *
  21   * @author Fabien Potencier <fabien@symfony.com>
  22   */
  23  class ExceptionDataCollector extends DataCollector
  24  {
  25      /**
  26       * {@inheritdoc}
  27       */
  28      public function collect(Request $request, Response $response, \Exception $exception = null)
  29      {
  30          if (null !== $exception) {
  31              $this->data = [
  32                  'exception' => FlattenException::create($exception),
  33              ];
  34          }
  35      }
  36  
  37      /**
  38       * {@inheritdoc}
  39       */
  40      public function reset()
  41      {
  42          $this->data = [];
  43      }
  44  
  45      /**
  46       * Checks if the exception is not null.
  47       *
  48       * @return bool true if the exception is not null, false otherwise
  49       */
  50      public function hasException()
  51      {
  52          return isset($this->data['exception']);
  53      }
  54  
  55      /**
  56       * Gets the exception.
  57       *
  58       * @return \Exception|FlattenException
  59       */
  60      public function getException()
  61      {
  62          return $this->data['exception'];
  63      }
  64  
  65      /**
  66       * Gets the exception message.
  67       *
  68       * @return string The exception message
  69       */
  70      public function getMessage()
  71      {
  72          return $this->data['exception']->getMessage();
  73      }
  74  
  75      /**
  76       * Gets the exception code.
  77       *
  78       * @return int The exception code
  79       */
  80      public function getCode()
  81      {
  82          return $this->data['exception']->getCode();
  83      }
  84  
  85      /**
  86       * Gets the status code.
  87       *
  88       * @return int The status code
  89       */
  90      public function getStatusCode()
  91      {
  92          return $this->data['exception']->getStatusCode();
  93      }
  94  
  95      /**
  96       * Gets the exception trace.
  97       *
  98       * @return array The exception trace
  99       */
 100      public function getTrace()
 101      {
 102          return $this->data['exception']->getTrace();
 103      }
 104  
 105      /**
 106       * {@inheritdoc}
 107       */
 108      public function getName()
 109      {
 110          return 'exception';
 111      }
 112  }


Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1