Completed
Push — 2.x ( 5f03c1...dc1b30 )
by Akihito
02:38
created

AspectBind::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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
            }
35
        }
36
37 8
        return $bindings;
38
    }
39
}
40