@@ -17,6 +17,9 @@ class ArrayView implements \ArrayAccess, \Iterator, \Countable
1717 private array $ keys ;
1818 private int $ position = 0 ;
1919
20+ /**
21+ * __construct method
22+ */
2023 public function __construct (
2124 array &$ source ,
2225 int $ offset ,
@@ -29,11 +32,17 @@ public function __construct(
2932 $ this ->keys = array_slice (array_keys ($ source ), $ this ->offset , $ this ->length );
3033 }
3134
35+ /**
36+ * OffsetExists method
37+ */
3238 public function offsetExists ($ offset ): bool
3339 {
3440 return isset ($ this ->keys [$ offset ]);
3541 }
3642
43+ /**
44+ * OffsetGet method
45+ */
3746 public function offsetGet ($ offset ): mixed
3847 {
3948 if (!$ this ->offsetExists ($ offset )) {
@@ -43,6 +52,9 @@ public function offsetGet($offset): mixed
4352 return $ this ->source [$ realKey ];
4453 }
4554
55+ /**
56+ * OffsetSet method
57+ */
4658 public function offsetSet ($ offset , $ value ): void
4759 {
4860 if ($ this ->offsetExists ($ offset )) {
@@ -51,6 +63,9 @@ public function offsetSet($offset, $value): void
5163 }
5264 }
5365
66+ /**
67+ * OffsetUnset method
68+ */
5469 public function offsetUnset ($ offset ): void
5570 {
5671 if ($ this ->offsetExists ($ offset )) {
@@ -61,32 +76,50 @@ public function offsetUnset($offset): void
6176 }
6277 }
6378
79+ /**
80+ * Current method
81+ */
6482 public function current (): mixed
6583 {
6684 $ key = $ this ->keys [$ this ->position ];
6785 return $ this ->source [$ key ];
6886 }
6987
88+ /**
89+ * Key method
90+ */
7091 public function key (): mixed
7192 {
7293 return $ this ->keys [$ this ->position ];
7394 }
7495
96+ /**
97+ * Next method
98+ */
7599 public function next (): void
76100 {
77101 $ this ->position ++;
78102 }
79103
104+ /**
105+ * Rewind method
106+ */
80107 public function rewind (): void
81108 {
82109 $ this ->position = 0 ;
83110 }
84111
112+ /**
113+ * Valid method
114+ */
85115 public function valid (): bool
86116 {
87117 return $ this ->position < count ($ this ->keys );
88118 }
89119
120+ /**
121+ * Count method
122+ */
90123 public function count (): int
91124 {
92125 return count ($ this ->keys );
0 commit comments