Passed
Push — task/question-descriptions-opt... ( ce2668 )
by Grant
17:51 queued 08:44
created

SkillComposer::compose()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace App\Http\ViewComposers;
4
5
use Illuminate\View\View;
6
use Illuminate\Support\Facades\Lang;
7
use App\Models\Lookup\SkillLevel;
8
9
class SkillComposer
10
{
11
    /**
12
     * @var mixed $skillLevels
13
     */
14
    private $skillLevels;
15
16
    /**
17
     * Bind data to the view.
18
     *
19
     * @param View $view View being rendered.
20
     *
21
     * @return void
22
     */
23 6
    public function compose(View $view) : void
24
    {
25 6
        if (!$this->skillLevels) {
26 6
            $this->skillLevels = SkillLevel::all();
27
        }
28
29 6
        $view->with('skill_levels', $this->skillLevels);
30 6
        $view->with('skill_template', Lang::get('common/skills'));
31 6
    }
32
}
33