Base::__get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Slim Framework controller creator (https://github.com/juliangut/slim-controller)
4
 *
5
 * @link https://github.com/juliangut/slim-controller for the canonical source repository
6
 *
7
 * @license https://raw.githubusercontent.com/juliangut/slim-controller/master/LICENSE
8
 */
9
10
namespace Jgut\Slim\Controller;
11
12
use Interop\Container\ContainerInterface;
13
14
/**
15
 * Base Slim Framework controller.
16
 */
17
class Base implements Controller
18
{
19
    /**
20
     * DI container.
21
     *
22
     * @var \Interop\Container\ContainerInterface
23
     */
24
    protected $container;
25
26
    /**
27
     * {@inheritdoc}
28 1
     */
29
    final public function setContainer(ContainerInterface &$container)
30 1
    {
31 1
        $this->container = $container;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36 1
     */
37
    final public function getContainer()
38 1
    {
39
        return $this->container;
40
    }
41
42
    /**
43
     * Bridge container get.
44
     *
45
     * @param string $name
46 1
     */
47
    final public function __get($name)
48 1
    {
49
        return $this->container->get($name);
50
    }
51
52
    /**
53
     * Bridge container has.
54
     *
55
     * @param string $name
56 1
     */
57
    final public function __isset($name)
58 1
    {
59
        return $this->container->has($name);
60
    }
61
}
62