Ei kuvausta

SilencedErrorContext.php 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\Debug\Exception;
  11. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', SilencedErrorContext::class, \Symfony\Component\ErrorHandler\Exception\SilencedErrorContext::class), \E_USER_DEPRECATED);
  12. /**
  13. * Data Object that represents a Silenced Error.
  14. *
  15. * @author Grégoire Pineau <lyrixx@lyrixx.info>
  16. *
  17. * @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext instead.
  18. */
  19. class SilencedErrorContext implements \JsonSerializable
  20. {
  21. public $count = 1;
  22. private $severity;
  23. private $file;
  24. private $line;
  25. private $trace;
  26. public function __construct(int $severity, string $file, int $line, array $trace = [], int $count = 1)
  27. {
  28. $this->severity = $severity;
  29. $this->file = $file;
  30. $this->line = $line;
  31. $this->trace = $trace;
  32. $this->count = $count;
  33. }
  34. public function getSeverity()
  35. {
  36. return $this->severity;
  37. }
  38. public function getFile()
  39. {
  40. return $this->file;
  41. }
  42. public function getLine()
  43. {
  44. return $this->line;
  45. }
  46. public function getTrace()
  47. {
  48. return $this->trace;
  49. }
  50. public function jsonSerialize()
  51. {
  52. return [
  53. 'severity' => $this->severity,
  54. 'file' => $this->file,
  55. 'line' => $this->line,
  56. 'trace' => $this->trace,
  57. 'count' => $this->count,
  58. ];
  59. }
  60. }