Completed
Branch 2.x (dc1b30)
by Akihito
02:25
created

AspectBind::inject()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3
Metric Value
dl 0
loc 11
cc 3
eloc 6
nc 3
nop 1
ccs 8
cts 8
cp 1
crap 3
rs 9.4285
1
<?php
2
/**
3
 * This file is part of the Ray.Di package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Ray\Di;
8
9
use Ray\Aop\Bind as AopBind;
10
11
final class AspectBind
12
{
13
    /**
14
     * @var AopBind
15
     */
16
    private $bind;
17
18 7
    public function __construct(AopBind $bind)
19
    {
20 7
        $this->bind = $bind;
21 7
    }
22
23
    /**
24
     * @param Container $container
25
     *
26
     * @return array
27
     */
28 8
    public function inject(Container $container)
29
    {
30 8
        $bindings = $this->bind->getBindings();
31 8
        foreach ($bindings as &$interceptors) {
32 8
            foreach ($interceptors as &$interceptor) {
33 8
                $interceptor = $container->getInstance($interceptor, Name::ANY);
34 8
            }
35 8
        }
36
37 8
        return $bindings;
38
    }
39
}
40