SilencedErrorContext.php 1.3 KB

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