Passed
Push — master ( 8bc21d...dfc3d9 )
by Gabriel
04:06
created

HasHelloViewPathsTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 9
c 1
b 0
f 1
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bootHasHelloViewPathsTrait() 0 5 1
A registerHelloViewPaths() 0 8 2
1
<?php
2
3
namespace ByTIC\Hello\Modules\AbstractModule\Controllers\Traits;
4
5
use ByTIC\Hello\Utility\ViewHelper;
6
7
/**
8
 * Trait HasHelloViewPathsTraitHasHelloViewPathsTrait
9
 * @package ByTIC\Hello\Modules\AbstractModule\Controllers\Traits
10
 */
11
trait HasHelloViewPathsTrait
12
{
13
    protected function bootHasHelloViewPathsTrait()
14
    {
15
        $this->after(
0 ignored issues
show
Bug introduced by
It seems like after() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
        $this->/** @scrutinizer ignore-call */ 
16
               after(
Loading history...
16
            function () {
17
                $this->registerHelloViewPaths();
18
            }
19
        );
20
    }
21
22
    protected function registerHelloViewPaths()
23
    {
24
        $view = $this->getView();
0 ignored issues
show
Bug introduced by
It seems like getView() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        /** @scrutinizer ignore-call */ 
25
        $view = $this->getView();
Loading history...
25
        $module = request()->getModuleName();
26
        if ($module == 'admin') {
27
            ViewHelper::registerAdminPaths($view);
28
        }
29
        ViewHelper::registerFrontendPaths($view);
30
    }
31
}