Test Failed
Push — feature/job-builder/update-job... ( 68ba7e...7a08dc )
by Xander
23:02 queued 10:32
created

DepartmentController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 11
c 1
b 0
f 0
dl 0
loc 22
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 15 3
1
<?php
2
3
namespace App\Http\Controllers\Api;
4
5
use App\Models\Lookup\Department;
6
use App\Http\Controllers\Controller;
7
8
class DepartmentController extends Controller
9
{
10
    /**
11
     * Return all skills as an array
12
     *
13
     * @return mixed
14
     */
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
    }
31
}
32