Controller::getParamater()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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