File tree 3 files changed +48
-5
lines changed
3 files changed +48
-5
lines changed Original file line number Diff line number Diff line change 25
25
"autoload-dev" : {
26
26
"psr-4" : {
27
27
"DMS\\ PHPUnitExtensions\\ ArraySubset\\ Tests\\ " : " tests"
28
- },
29
- "classmap" : [
30
- " vendor/phpunit/phpunit/tests/"
31
- ]
28
+ }
32
29
}
33
30
}
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+
3
+ namespace DMS \PHPUnitExtensions \ArraySubset ;
4
+
5
+ use ArrayAccess ;
6
+ use ArrayIterator ;
7
+ use IteratorAggregate ;
8
+
9
+ class ArrayAccessible implements ArrayAccess, IteratorAggregate
10
+ {
11
+ private $ array ;
12
+
13
+ public function __construct (array $ array = [])
14
+ {
15
+ $ this ->array = $ array ;
16
+ }
17
+
18
+ public function offsetExists ($ offset )
19
+ {
20
+ return \array_key_exists ($ offset , $ this ->array );
21
+ }
22
+
23
+ public function offsetGet ($ offset )
24
+ {
25
+ return $ this ->array [$ offset ];
26
+ }
27
+
28
+ public function offsetSet ($ offset , $ value ): void
29
+ {
30
+ if (null === $ offset ) {
31
+ $ this ->array [] = $ value ;
32
+ } else {
33
+ $ this ->array [$ offset ] = $ value ;
34
+ }
35
+ }
36
+
37
+ public function offsetUnset ($ offset ): void
38
+ {
39
+ unset($ this ->array [$ offset ]);
40
+ }
41
+
42
+ public function getIterator ()
43
+ {
44
+ return new ArrayIterator ($ this ->array );
45
+ }
46
+ }
Original file line number Diff line number Diff line change 3
3
4
4
namespace DMS \PHPUnitExtensions \ArraySubset \Tests \Unit \Constraint ;
5
5
6
- use ArrayAccessible ;
6
+ use DMS \ PHPUnitExtensions \ ArraySubset \ ArrayAccessible ;
7
7
use ArrayObject ;
8
8
use Countable ;
9
9
use DMS \PHPUnitExtensions \ArraySubset \Constraint \ArraySubset ;
You can’t perform that action at this time.
0 commit comments