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

ReferenceComposer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 22
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 0 8 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