| 1 | <?php |
||
| 25 | class CurrentWeatherGroup implements \Iterator |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * An array of {@link CurrentWeather} objects. |
||
| 29 | * |
||
| 30 | * @var CurrentWeather[] |
||
| 31 | * |
||
| 32 | * @see CurrentWeather The CurrentWeather class. |
||
| 33 | */ |
||
| 34 | private $currentWeathers; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @internal |
||
| 38 | */ |
||
| 39 | private $position = 0; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Create a new current weathers group object. |
||
| 43 | * |
||
| 44 | * @param \stdClass $json The current weathers group json. |
||
| 45 | * @param string $units The units used. |
||
| 46 | * |
||
| 47 | * @internal |
||
| 48 | */ |
||
| 49 | 5 | public function __construct(\stdClass $json, $units) |
|
| 50 | { |
||
| 51 | 5 | foreach ($json->list as $currentWeather) { |
|
| 52 | 5 | $this->currentWeathers[] = new CurrentWeather($currentWeather, $units); |
|
| 53 | 5 | } |
|
| 54 | 5 | } |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @internal |
||
| 58 | */ |
||
| 59 | 3 | public function rewind() |
|
| 63 | |||
| 64 | /** |
||
| 65 | * @internal |
||
| 66 | */ |
||
| 67 | 3 | public function current() |
|
| 71 | |||
| 72 | /** |
||
| 73 | * @internal |
||
| 74 | */ |
||
| 75 | 2 | public function key() |
|
| 79 | |||
| 80 | /** |
||
| 81 | * @internal |
||
| 82 | */ |
||
| 83 | 2 | public function next() |
|
| 87 | |||
| 88 | /** |
||
| 89 | * @internal |
||
| 90 | */ |
||
| 91 | 1 | public function valid() |
|
| 95 | } |
||
| 96 |