ObjectParameter.php 958 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. declare(strict_types = 1);
  3. /**
  4. * This file is part of the Symfony package.
  5. *
  6. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  7. * SPDX-FileCopyrightText: 2022 Fabien Potencier <fabien@symfony.com>
  8. * SPDX-License-Identifier: AGPL-3.0-or-later AND MIT
  9. */
  10. namespace OC\DB;
  11. final class ObjectParameter {
  12. private $object;
  13. private $error;
  14. private $stringable;
  15. private $class;
  16. /**
  17. * @param object $object
  18. */
  19. public function __construct($object, ?\Throwable $error) {
  20. $this->object = $object;
  21. $this->error = $error;
  22. $this->stringable = \is_callable([$object, '__toString']);
  23. $this->class = \get_class($object);
  24. }
  25. /**
  26. * @return object
  27. */
  28. public function getObject() {
  29. return $this->object;
  30. }
  31. public function getError(): ?\Throwable {
  32. return $this->error;
  33. }
  34. public function isStringable(): bool {
  35. return $this->stringable;
  36. }
  37. public function getClass(): string {
  38. return $this->class;
  39. }
  40. }