DeprecationNotice.php 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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\Bridge\PhpUnit\DeprecationErrorHandler;
  11. /**
  12. * @internal
  13. */
  14. final class DeprecationNotice
  15. {
  16. private $count = 0;
  17. /**
  18. * @var int[]
  19. */
  20. private $countsByCaller = [];
  21. public function addObjectOccurrence($class, $method)
  22. {
  23. if (!isset($this->countsByCaller["$class::$method"])) {
  24. $this->countsByCaller["$class::$method"] = 0;
  25. }
  26. ++$this->countsByCaller["$class::$method"];
  27. ++$this->count;
  28. }
  29. public function addProceduralOccurrence()
  30. {
  31. ++$this->count;
  32. }
  33. public function getCountsByCaller()
  34. {
  35. return $this->countsByCaller;
  36. }
  37. public function count()
  38. {
  39. return $this->count;
  40. }
  41. }