PagesComposer::compose()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 3
nop 1
1
<?php
2
3
namespace App\Http\ViewComposers;
4
5
use App\Repositories\PagesRepository;
6
use Illuminate\Contracts\View\View;
7
8
class PagesComposer extends Composer
9
{
10
    /**
11
     * @var PagesRepository
12
     */
13
    protected $pages;
14
15
    /**
16
     * PagesComposer constructor.
17
     * @param PagesRepository $pagesRepository
18
     */
19
    public function __construct(PagesRepository $pagesRepository)
20
    {
21
        $this->pages = $pagesRepository;
22
    }
23
24
    /**
25
     * @param View $view
26
     * @return $this
27
     */
28
    public function compose(View $view)
29
    {
30
        switch ($view->getName())
31
        {
32
            case "partials.header.index":
33
                return $view->with('pages', $this->pages->getHeader());
34
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
35
36
            case "partials.footer.navigation_sidebar":
37
                return $view->with('pages', $this->pages->getFooter());
38
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
39
        }
40
    }
41
}