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
99{
1010 use EntityTrait;
1111
12+ private int $ numResults ;
13+
1214 private Coordinate $ coordinate ;
1315
1416 /** @var AirPollutionData[] */
1517 private array $ data ;
1618
1719 public function __construct (array $ data )
1820 {
21+ $ this ->numResults = \count ($ data ['list ' ]);
1922 $ this ->coordinate = new Coordinate ($ data ['coord ' ]);
2023 $ this ->data = $ this ->createEntityList (AirPollutionData::class, $ data ['list ' ]);
2124 }
2225
26+ public function getNumResults (): int
27+ {
28+ return $ this ->numResults ;
29+ }
30+
2331 public function getCoordinate (): Coordinate
2432 {
2533 return $ this ->coordinate ;
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ public function testMethods()
3636 ]
3737 ]);
3838
39+ $ this ->assertSame (1 , $ entity ->getNumResults ());
3940 $ this ->assertInstanceOf (Coordinate::class, $ entity ->getCoordinate ());
4041 $ this ->assertContainsOnlyInstancesOf (AirPollutionData::class, $ entity ->getData ());
4142 }
You can’t perform that action at this time.
0 commit comments