| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 1 | public function index() |
|
| 16 | { |
||
| 17 | 1 | $departments = Department::all(); |
|
| 18 | 1 | $departmentsTranslated = []; |
|
| 19 | 1 | foreach ($departments as $department) { |
|
| 20 | 1 | $deptArray = ['id' => $department->id]; |
|
| 21 | 1 | foreach (['en', 'fr'] as $locale) { |
|
| 22 | 1 | $deptArray[$locale] = [ |
|
| 23 | 1 | 'name' => $department->getTranslation('name', $locale), |
|
| 24 | 1 | 'impact' => $department->getTranslation('impact', $locale), |
|
| 25 | ]; |
||
| 26 | } |
||
| 27 | 1 | $departmentsTranslated[] = $deptArray; |
|
| 28 | } |
||
| 29 | 1 | return $departmentsTranslated; |
|
| 30 | } |
||
| 32 |