File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,25 @@ class AirPollutionCollection
9
9
{
10
10
use EntityTrait;
11
11
12
+ private int $ numResults ;
13
+
12
14
private Coordinate $ coordinate ;
13
15
14
16
/** @var AirPollutionData[] */
15
17
private array $ data ;
16
18
17
19
public function __construct (array $ data )
18
20
{
21
+ $ this ->numResults = \count ($ data ['list ' ]);
19
22
$ this ->coordinate = new Coordinate ($ data ['coord ' ]);
20
23
$ this ->data = $ this ->createEntityList (AirPollutionData::class, $ data ['list ' ]);
21
24
}
22
25
26
+ public function getNumResults (): int
27
+ {
28
+ return $ this ->numResults ;
29
+ }
30
+
23
31
public function getCoordinate (): Coordinate
24
32
{
25
33
return $ this ->coordinate ;
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ public function testMethods()
36
36
]
37
37
]);
38
38
39
+ $ this ->assertSame (1 , $ entity ->getNumResults ());
39
40
$ this ->assertInstanceOf (Coordinate::class, $ entity ->getCoordinate ());
40
41
$ this ->assertContainsOnlyInstancesOf (AirPollutionData::class, $ entity ->getData ());
41
42
}
You can’t perform that action at this time.
0 commit comments