[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/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 = array(
  32                  'exception' => FlattenException::create($exception),
  33              );
  34          }
  35      }
  36  
  37      /**
  38       * Checks if the exception is not null.
  39       *
  40       * @return bool true if the exception is not null, false otherwise
  41       */
  42      public function hasException()
  43      {
  44          return isset($this->data['exception']);
  45      }
  46  
  47      /**
  48       * Gets the exception.
  49       *
  50       * @return \Exception The exception
  51       */
  52      public function getException()
  53      {
  54          return $this->data['exception'];
  55      }
  56  
  57      /**
  58       * Gets the exception message.
  59       *
  60       * @return string The exception message
  61       */
  62      public function getMessage()
  63      {
  64          return $this->data['exception']->getMessage();
  65      }
  66  
  67      /**
  68       * Gets the exception code.
  69       *
  70       * @return int The exception code
  71       */
  72      public function getCode()
  73      {
  74          return $this->data['exception']->getCode();
  75      }
  76  
  77      /**
  78       * Gets the status code.
  79       *
  80       * @return int The status code
  81       */
  82      public function getStatusCode()
  83      {
  84          return $this->data['exception']->getStatusCode();
  85      }
  86  
  87      /**
  88       * Gets the exception trace.
  89       *
  90       * @return array The exception trace
  91       */
  92      public function getTrace()
  93      {
  94          return $this->data['exception']->getTrace();
  95      }
  96  
  97      /**
  98       * {@inheritdoc}
  99       */
 100      public function getName()
 101      {
 102          return 'exception';
 103      }
 104  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1