PluginProbe
Media Cloud Sync / 1.2.12
Media Cloud Sync v1.2.12
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / s3 / Aws / HasDataTrait.php

HasDataTrait.php in Media Cloud Sync 1.2.12, at includes/sdk/s3/Aws/HasDataTrait.php

75 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws;
4
5 /**
6 * Trait implementing ToArrayInterface, \ArrayAccess, \Countable, and
7 * \IteratorAggregate
8 */
9 trait HasDataTrait
10 {
11 /** @var array */
12 private $data = [];
13 /**
14 * @return \Traversable
15 */
16 #[\ReturnTypeWillChange]
17 public function getIterator()
18 {
19 return new \ArrayIterator($this->data);
20 }
21 /**
22 * This method returns a reference to the variable to allow for indirect
23 * array modification (e.g., $foo['bar']['baz'] = 'qux').
24 *
25 * @param $offset
26 *
27 * @return mixed|null
28 */
29 #[\ReturnTypeWillChange]
30 public function &offsetGet($offset)
31 {
32 if (isset($this->data[$offset])) {
33 return $this->data[$offset];
34 }
35 $value = null;
36 return $value;
37 }
38 /**
39 * @return void
40 */
41 #[\ReturnTypeWillChange]
42 public function offsetSet($offset, $value)
43 {
44 $this->data[$offset] = $value;
45 }
46 /**
47 * @return bool
48 */
49 #[\ReturnTypeWillChange]
50 public function offsetExists($offset)
51 {
52 return isset($this->data[$offset]);
53 }
54 /**
55 * @return void
56 */
57 #[\ReturnTypeWillChange]
58 public function offsetUnset($offset)
59 {
60 unset($this->data[$offset]);
61 }
62 public function toArray()
63 {
64 return $this->data;
65 }
66 /**
67 * @return int
68 */
69 #[\ReturnTypeWillChange]
70 public function count()
71 {
72 return \count($this->data);
73 }
74 }
75