Completed
Push — master ( 723848...f6a9f3 )
by Yaro
05:45
created

BreadcrumbsTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 22
ccs 5
cts 10
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A breadcrumbs() 0 4 1
A initBreadcrumbs() 0 12 1
1
<?php
2
3
namespace Yaro\Jarboe\Http\Controllers\Traits;
4
5
use Illuminate\Support\Facades\View;
6
use Yaro\Jarboe\ViewComponents\Breadcrumbs\BreadcrumbsInterface;
7
8
trait BreadcrumbsTrait
9
{
10
    protected $breadcrumbs;
11
12
    public function breadcrumbs(): BreadcrumbsInterface
13
    {
14
        return $this->breadcrumbs;
15
    }
16
17 33
    protected function initBreadcrumbs()
18
    {
19
        View::composer('jarboe::crud.list', function ($view) {
20
            $view->with('breadcrumbs', $this->breadcrumbs());
21 33
        });
22
        View::composer('jarboe::crud.create', function ($view) {
23
            $view->with('breadcrumbs', $this->breadcrumbs());
24 33
        });
25
        View::composer('jarboe::crud.edit', function ($view) {
26
            $view->with('breadcrumbs', $this->breadcrumbs());
27 33
        });
28 33
    }
29
}
30