| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class DefaultChangelogFactory implements ChangelogFactory |
||
| 11 | { |
||
| 12 | /** @inheritDoc */ |
||
| 13 | 3 | public function create(array $data): Changelog |
|
| 14 | { |
||
| 15 | 3 | return new DefaultChangelog( |
|
| 16 | 3 | $data['version'], |
|
| 17 | 3 | new DateTimeImmutable($data['date']), |
|
| 18 | 3 | $this->createStatusCollection($data), |
|
| 19 | 3 | ); |
|
| 20 | } |
||
| 21 | |||
| 22 | /** @inheritDoc */ |
||
| 23 | 3 | public function createCollection(array $data): ChangelogCollection |
|
| 24 | { |
||
| 25 | 3 | return new DefaultChangelogCollection( |
|
| 26 | 3 | array_map(fn (array $version): Changelog => $this->create($version), $data['versions']), |
|
| 27 | 3 | ); |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param array<string,mixed> $data |
||
| 32 | */ |
||
| 33 | 3 | private function createStatus(array $data): ChangelogStatus |
|
| 38 | 3 | ); |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param array<string,mixed> $data |
||
| 43 | */ |
||
| 44 | 3 | private function createStatusCollection(array $data): ChangelogStatusCollection |
|
| 48 | 3 | ); |
|
| 49 | } |
||
| 50 | } |
||
| 51 |