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

PimpleContainer::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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