File tree Expand file tree Collapse file tree 3 files changed +48
-5
lines changed Expand file tree Collapse file tree 3 files changed +48
-5
lines changed Original file line number Diff line number Diff line change 2525 "autoload-dev" : {
2626 "psr-4" : {
2727 "DMS\\ PHPUnitExtensions\\ ArraySubset\\ Tests\\ " : " tests"
28- },
29- "classmap" : [
30- " vendor/phpunit/phpunit/tests/"
31- ]
28+ }
3229 }
3330}
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 33
44namespace DMS \PHPUnitExtensions \ArraySubset \Tests \Unit \Constraint ;
55
6- use ArrayAccessible ;
6+ use DMS \ PHPUnitExtensions \ ArraySubset \ ArrayAccessible ;
77use ArrayObject ;
88use Countable ;
99use DMS \PHPUnitExtensions \ArraySubset \Constraint \ArraySubset ;
You can’t perform that action at this time.
0 commit comments