Passed
Push — master ( 4f415b...b6b0b7 )
by Gabriel
03:01
created

Controller::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 1
b 0
f 0
ccs 0
cts 4
cp 0
cc 2
nc 2
nop 2
crap 6
1
<?php
2
3
namespace Nip\Controllers;
4
5
use Nip\Controllers\Traits\BaseControllerTrait;
6
7
/**
8
 * Class Controller
9
 * @package Nip
10
 */
11
class Controller
12
{
13
    use BaseControllerTrait;
14
15
    /**
16
     * Controller constructor.
17
     */
18 2
    public function __construct()
19
    {
20
//        $this->inflectName();
21 2
    }
22
23
    /**
24
     * @param $name
25
     * @param $arguments
26
     * @return bool|mixed
27
     */
28
    public function __call($name, $arguments)
29
    {
30
        if ($name === ucfirst($name)) {
31
            return $this->getHelper($name);
32
        }
33
34
        return trigger_error("Call to undefined method [$name] in controller [{$this->getClassName()}]", E_USER_ERROR);
35
    }
36
37
38
39
    /**
40
     * @return string
41
     */
42
    public function getRootNamespace()
43
    {
44
        return $this->getApplication()->getRootNamespace();
45
    }
46
47
    /**
48
     * @return Application
0 ignored issues
show
Bug introduced by
The type Nip\Controllers\Application was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
     */
50
    public function getApplication()
51
    {
52
        return app('app');
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

52
        return /** @scrutinizer ignore-call */ app('app');
Loading history...
53
    }
54
}
55