Passed
Push — master ( afb0ae...0b11b9 )
by Radu
02:01
created

ControllerTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 2 1
A setupPaths() 0 6 1
1
<?php
2
namespace ParcelValue\ApiClient\Traits;
3
4
trait ControllerTrait
5
{
6
    abstract protected function config();
7
    abstract protected function request();
8
    abstract protected function setData($key, $value);
9
10
    protected function setupPaths()
11
    {
12
        $this->setData('path', $this->config()->get('app/path'));
13
        $this->setData('url/app', $this->request()->getAppUrl());
14
        $this->setData('url/lang', $this->request()->getUrl(['lang']));
15
        $this->setData('url/current', $this->request()->getUrl());
16
    }
17
18
    /**
19
     * Called (optionally) by each method.
20
     */
21
    protected function init()
22
    {
23
    }
24
}
25