Completed
Push — master ( 87ad62...d12792 )
by Beniamin
03:02
created

PimpleContainer   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 57
ccs 15
cts 15
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
A has() 0 4 1
A setParameter() 0 4 1
A setServiceFromCallback() 0 4 1
A getWrappedContainer() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\SQLBuilder\DependencyInjection;
13
14
use Interop\Container\ContainerInterface;
15
use Pimple\Container;
16
17
/**
18
 * @author Beniamin Jonatan Šimko <[email protected]>
19
 */
20
class PimpleContainer implements ContainerInterface
21
{
22
    /**
23
     * @var Container
24
     */
25
    private $wrappedContainer;
26
27
    /**
28
     * @param Container $container
29
     */
30 3
    public function __construct(Container $container)
31
    {
32 3
        $this->wrappedContainer = $container;
33 3
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38 2
    public function get($id)
39
    {
40 2
        return $this->wrappedContainer->offsetGet($id);
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46 2
    public function has($id)
47
    {
48 2
        return $this->wrappedContainer->offsetExists($id);
49
    }
50
51
    /**
52
     * @param string $id
53
     * @param string $value
54
     */
55 1
    public function setParameter($id, $value)
56
    {
57 1
        $this->wrappedContainer[$id] = $value;
58 1
    }
59
60
    /**
61
     * @param string   $id
62
     * @param callable $callback
63
     */
64 1
    public function setServiceFromCallback($id, callable $callback)
65
    {
66 1
        $this->wrappedContainer[$id] = new InvokeCallback($callback);
67 1
    }
68
69
    /**
70
     * @return Container
71
     */
72 1
    public function getWrappedContainer()
73
    {
74 1
        return $this->wrappedContainer;
75
    }
76
}