ApiVersion.php
2 months ago
CaseInsensitiveArray.php
2 months ago
DefaultLogger.php
2 months ago
EventTypes.php
2 months ago
LoggerInterface.php
2 months ago
ObjectTypes.php
2 months ago
RandomGenerator.php
2 months ago
RequestOptions.php
2 months ago
Set.php
2 months ago
Util.php
2 months ago
Set.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePressVendor\Stripe\Util; |
| 4 | |
| 5 | use ArrayIterator; |
| 6 | use IteratorAggregate; |
| 7 | class Set implements IteratorAggregate |
| 8 | { |
| 9 | private $_elts; |
| 10 | public function __construct($members = []) |
| 11 | { |
| 12 | $this->_elts = []; |
| 13 | foreach ($members as $item) { |
| 14 | $this->_elts[$item] = \true; |
| 15 | } |
| 16 | } |
| 17 | public function includes($elt) |
| 18 | { |
| 19 | return isset($this->_elts[$elt]); |
| 20 | } |
| 21 | public function add($elt) |
| 22 | { |
| 23 | $this->_elts[$elt] = \true; |
| 24 | } |
| 25 | public function discard($elt) |
| 26 | { |
| 27 | unset($this->_elts[$elt]); |
| 28 | } |
| 29 | public function toArray() |
| 30 | { |
| 31 | return \array_keys($this->_elts); |
| 32 | } |
| 33 | /** |
| 34 | * @return ArrayIterator |
| 35 | */ |
| 36 | #[\ReturnTypeWillChange] |
| 37 | public function getIterator() |
| 38 | { |
| 39 | return new ArrayIterator($this->toArray()); |
| 40 | } |
| 41 | } |
| 42 |