Response.php 888 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace addons\epay\library;
  3. class Response extends \Symfony\Component\HttpFoundation\Response implements \JsonSerializable, \Serializable
  4. {
  5. public function __toString()
  6. {
  7. return $this->getContent();
  8. }
  9. public function jsonSerialize(): mixed
  10. {
  11. return $this->getContent();
  12. }
  13. public function serialize()
  14. {
  15. return serialize($this->content);
  16. }
  17. public function unserialize($data)
  18. {
  19. return $this->content = unserialize($data);
  20. }
  21. /**
  22. * (PHP 8.1+) Magic method for serialization.
  23. *
  24. * @return mixed
  25. */
  26. public function __serialize()
  27. {
  28. return $this->content;
  29. }
  30. /**
  31. * (PHP 8.1+) Magic method for unserialization.
  32. *
  33. * @param array $data
  34. */
  35. public function __unserialize(array $data): void
  36. {
  37. $this->content = $data;
  38. }
  39. }