Passed
Branch cake4 (6bfeea)
by n
02:11
created

ContainerBag::complement()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace N1215\CakeCandle;
5
6
use N1215\CakeCandle\Invoker\InvokerInterface;
7
use Psr\Container\ContainerInterface;
8
9
final class ContainerBag implements ContainerBagInterface
10
{
11
    /**
12
     * @var ContainerInterface
13
     */
14
    private $container;
15
16
    /**
17
     * @var InvokerInterface
18
     */
19
    private $invoker;
20
21 14
    public function __construct(ContainerInterface $container, InvokerInterface $invoker)
22
    {
23 14
        $this->container = $container;
24 14
        $this->invoker = $invoker;
25 14
    }
26
27
    /**
28
     * @param string $id
29
     * @return mixed
30
     */
31 7
    public function get($id)
32
    {
33 7
        return $this->container->get($id);
34
    }
35
36
    /**
37
     * @param string $id
38
     * @return bool
39
     */
40 1
    public function has($id): bool
41
    {
42 1
        return $this->container->has($id);
43
    }
44
45
    /**
46
     * @param callable $callable
47
     * @param array $args
48
     * @return mixed
49
     * @throws Invoker\Exceptions\InvocationException
50
     */
51 1
    public function call(callable $callable, array $args = [])
52
    {
53 1
        return $this->invoker->invoke($callable, $args);
54
    }
55
56
    /**
57
     * @param callable $callable
58
     * @param array $args
59
     * @return array
60
     * @throws Invoker\Exceptions\InvocationException
61
     */
62
    public function complement(callable $callable, array $args = []): array
63
    {
64
        return $this->invoker->complement($callable, $args);
65
    }
66
}
67