| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 1 | public function new(string $language, string $type, int $wordCount): GameDto |
|
| 22 | { |
||
| 23 | 1 | $crossword = $this->constructor->construct(new CrosswordCriteria($language, $type, $wordCount)); |
|
| 24 | 1 | $grid = new Grid($crossword); |
|
| 25 | 1 | $definitions = array_map(static fn (array $item) => $item['word']['definition'], $crossword); |
|
| 26 | 1 | foreach ($crossword as $index => $line) { |
|
| 27 | 1 | foreach ($line['line'] as $number => $cell) { |
|
| 28 | 1 | $grid->fillLetter($cell); |
|
| 29 | 1 | $grid->fillCrossLineNumbers($cell, $index); |
|
| 30 | 1 | 0 === $number && $grid->fillLineNumbers($cell, $index); |
|
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | 1 | return new GameDto($grid->field(), $grid->size(), $definitions); |
|
| 35 | } |
||
| 37 |