| Code Coverage | ||||||||||
| Classes and Traits | Functions and Methods | Lines | ||||||||
| Total |  | 100.00% | 1 / 1 |  | 100.00% | 3 / 3 | CRAP |  | 100.00% | 7 / 7 | 
| ForecastResponse |  | 100.00% | 1 / 1 |  | 100.00% | 3 / 3 | 4 |  | 100.00% | 7 / 7 | 
| __construct |  | 100.00% | 1 / 1 | 1 |  | 100.00% | 2 / 2 | |||
| getForecasts |  | 100.00% | 1 / 1 | 1 |  | 100.00% | 1 / 1 | |||
| __toString |  | 100.00% | 1 / 1 | 2 |  | 100.00% | 4 / 4 | |||
| 1 | <?php | 
| 2 | |
| 3 | namespace App\Application; | 
| 4 | |
| 5 | use App\Domain\Weather\Forecast; | 
| 6 | use Stringable; | 
| 7 | |
| 8 | class ForecastResponse implements Stringable | 
| 9 | { | 
| 10 | /** | 
| 11 | * @param Forecast[] $forecasts | 
| 12 | */ | 
| 13 | public function __construct( | 
| 14 | private array $forecasts | 
| 15 | ) { | 
| 16 | } | 
| 17 | |
| 18 | /** | 
| 19 | * @return Forecast[] | 
| 20 | */ | 
| 21 | public function getForecasts(): array | 
| 22 | { | 
| 23 | return $this->forecasts; | 
| 24 | } | 
| 25 | |
| 26 | public function __toString(): string | 
| 27 | { | 
| 28 | $array = []; | 
| 29 | foreach ($this->getForecasts() as $forecast) { | 
| 30 | $array[] = $forecast->getDay()->getCondition()->getText(); | 
| 31 | } | 
| 32 | |
| 33 | return implode(' - ', $array); | 
| 34 | } | 
| 35 | } |