CourseComposer::compose()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
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\CourseStatus;
8
9
class CourseComposer
10
{
11
    /**
12
     * @var mixed $courseStatuses
13
     */
14
    private $courseStatuses;
15
16
    /**
17
     * Bind data to the view.
18
     *
19
     * @param View $view View being rendered.
20
     *
21
     * @return void
22
     */
23
    public function compose(View $view) : void
24
    {
25
        if (!$this->courseStatuses) {
26
            $this->courseStatuses = CourseStatus::all();
27
        }
28
29
        $view->with('course_status', $this->courseStatuses);
30
        $view->with('course_template', Lang::get('common/course'));
31
    }
32
}
33