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

ReferenceComposer::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\Relationship;
8
9
class ReferenceComposer
10
{
11
    /**
12
     * @var mixed $relationships
13
     */
14
    private $relationships;
15
16
    /**
17
     * Bind data to the view.
18
     *
19
     * @param View $view View being rendered.
20
     *
21
     * @return void
22
     */
23 1
    public function compose(View $view) : void
24
    {
25 1
        if (!$this->relationships) {
26 1
            $this->relationships = Relationship::all();
27
        }
28
29 1
        $view->with('relationships', $this->relationships);
30 1
        $view->with('reference_template', Lang::get('common/references'));
31 1
    }
32
}
33