| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 4 | public function translate(): int |
|
| 23 | { |
||
| 24 | 4 | $count = 0; |
|
| 25 | 4 | foreach ($this->something as $something) { |
|
| 26 | 2 | if (empty($texts = $something[0]->load())) { |
|
| 27 | 2 | continue; |
|
| 28 | } |
||
| 29 | 2 | $newTexts = $something[2]->translate(array_values($texts)); |
|
| 30 | 2 | ||
| 31 | 2 | $translations = []; |
|
| 32 | 2 | foreach ($texts as $key => $text) { |
|
| 33 | $translations[$key] = $newTexts[$text] ?? ''; |
||
| 34 | 2 | $count++; |
|
| 35 | } |
||
| 36 | 4 | $something[1]->save($translations); |
|
| 37 | } |
||
| 38 | return $count; |
||
| 39 | } |
||
| 41 |