ObjectParameter.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Doctrine\DataCollector;
  11. final class ObjectParameter
  12. {
  13. private $object;
  14. private $error;
  15. private $stringable;
  16. private $class;
  17. /**
  18. * @param object $object
  19. */
  20. public function __construct($object, ?\Throwable $error)
  21. {
  22. $this->object = $object;
  23. $this->error = $error;
  24. $this->stringable = \is_callable([$object, '__toString']);
  25. $this->class = \get_class($object);
  26. }
  27. /**
  28. * @return object
  29. */
  30. public function getObject()
  31. {
  32. return $this->object;
  33. }
  34. public function getError(): ?\Throwable
  35. {
  36. return $this->error;
  37. }
  38. public function isStringable(): bool
  39. {
  40. return $this->stringable;
  41. }
  42. public function getClass(): string
  43. {
  44. return $this->class;
  45. }
  46. }