Completed
Push — master ( 9a91b7...87ad62 )
by Beniamin
04:43
created

PimpleContainer   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 57
ccs 0
cts 15
cp 0
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
    public function __construct(Container $container)
31
    {
32
        $this->wrappedContainer = $container;
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function get($id)
39
    {
40
        return $this->wrappedContainer->offsetGet($id);
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function has($id)
47
    {
48
        return $this->wrappedContainer->offsetExists($id);
49
    }
50
51
    /**
52
     * @param string $id
53
     * @param string $value
54
     */
55
    public function setParameter($id, $value)
56
    {
57
        $this->wrappedContainer[$id] = $value;
58
    }
59
60
    /**
61
     * @param string   $id
62
     * @param callable $callback
63
     */
64
    public function setServiceFromCallback($id, callable $callback)
65
    {
66
        $this->wrappedContainer[$id] = new InvokeCallback($callback);
67
    }
68
69
    /**
70
     * @return Container
71
     */
72
    public function getWrappedContainer()
73
    {
74
        return $this->wrappedContainer;
75
    }
76
}