Controller   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 23
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParamater() 0 3 1
A __construct() 0 3 1
1
<?php
2
namespace DevOp\Core\Framework;
3
4
use Psr\Container\ContainerInterface;
5
6
final class Controller
7
{
8
    /**
9
     * @var ContainerInterface
10
     */
11
    private $container;
12
13
    /**
14
     * @param ContainerInterface $container
15
     */
16
    public function __construct(ContainerInterface $container)
17
    {
18
        $this->container = $container;
19
    }
20
21
    /**
22
     * @param $name
23
     * @param mixed $default
24
     * @return mixed
25
     */
26
    public function getParamater($name, $default = null)
27
    {
28
        return $this->container->get($name, $default);
0 ignored issues
show
Unused Code introduced by
The call to Psr\Container\ContainerInterface::get() has too many arguments starting with $default. ( Ignorable by Annotation )

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

28
        return $this->container->/** @scrutinizer ignore-call */ get($name, $default);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
29
    }
30
}
31