SilencedErrorContext.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 $count = 1;
  19. private $severity;
  20. private $file;
  21. private $line;
  22. private $trace;
  23. public function __construct(int $severity, string $file, int $line, array $trace = [], int $count = 1)
  24. {
  25. $this->severity = $severity;
  26. $this->file = $file;
  27. $this->line = $line;
  28. $this->trace = $trace;
  29. $this->count = $count;
  30. }
  31. public function getSeverity(): int
  32. {
  33. return $this->severity;
  34. }
  35. public function getFile(): string
  36. {
  37. return $this->file;
  38. }
  39. public function getLine(): int
  40. {
  41. return $this->line;
  42. }
  43. public function getTrace(): array
  44. {
  45. return $this->trace;
  46. }
  47. public function jsonSerialize(): array
  48. {
  49. return [
  50. 'severity' => $this->severity,
  51. 'file' => $this->file,
  52. 'line' => $this->line,
  53. 'trace' => $this->trace,
  54. 'count' => $this->count,
  55. ];
  56. }
  57. }