Passed
Push — master ( e83847...16b30f )
by Radu
01:36
created

ControllerTrait::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
namespace ParcelValue\ApiClient\Traits;
3
4
trait ControllerTrait
5
{
6
    abstract protected function request();
7
    abstract protected function setData($key, $value);
8
9
    protected function initPaths()
10
    {
11
        $this->setData('path', $this->config()->get('app/path'));
0 ignored issues
show
Bug introduced by
It seems like config() 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

11
        $this->setData('path', $this->/** @scrutinizer ignore-call */ config()->get('app/path'));
Loading history...
12
        $this->setData('url/app', $this->request()->getAppUrl());
13
        $this->setData('url/lang', $this->request()->getUrl(['lang']));
14
        $this->setData('url/current', $this->request()->getUrl());
15
    }
16
17
    /**
18
     * Called (optionally) by each method.
19
     */
20
    protected function init($action)
0 ignored issues
show
Unused Code introduced by
The parameter $action is not used and could be removed. ( Ignorable by Annotation )

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

20
    protected function init(/** @scrutinizer ignore-unused */ $action)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
    {
22
    }
23
}
24