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

PimpleContainer::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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