SetValue.php 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Aws\DynamoDb;
  3. /**
  4. * Special object to represent a DynamoDB set (SS/NS/BS) value.
  5. */
  6. class SetValue implements \JsonSerializable, \Countable, \IteratorAggregate
  7. {
  8. /** @var array Values in the set as provided. */
  9. private $values;
  10. /**
  11. * @param array $values Values in the set.
  12. */
  13. public function __construct(array $values)
  14. {
  15. $this->values = $values;
  16. }
  17. /**
  18. * Get the values formatted for PHP and JSON.
  19. *
  20. * @return array
  21. */
  22. public function toArray()
  23. {
  24. return $this->values;
  25. }
  26. /**
  27. * @return int
  28. */
  29. #[\ReturnTypeWillChange]
  30. public function count()
  31. {
  32. return count($this->values);
  33. }
  34. #[\ReturnTypeWillChange]
  35. public function getIterator()
  36. {
  37. return new \ArrayIterator($this->values);
  38. }
  39. #[\ReturnTypeWillChange]
  40. public function jsonSerialize()
  41. {
  42. return $this->toArray();
  43. }
  44. }