Completed
Push — 2.x ( 144798...0daeb2 )
by Akihito
10s
created

ModuleString::__invoke()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 13
cts 13
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 13
nc 3
nop 2
crap 3
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * This file is part of the Ray.Di package.
6
 *
7
 * @license http://opensource.org/licenses/MIT MIT
8
 */
9
namespace Ray\Di;
10
11
final class ModuleString
12
{
13 1
    public function __invoke(Container $container, array $pointcuts) : string
14
    {
15 1
        $log = [];
16 1
        $contaier = unserialize(serialize($container));
17 1
        $spy = new SpyCompiler;
18 1
        foreach ($contaier->getContainer() as $dependencyIndex => $dependency) {
19 1
            if ($dependency instanceof Dependency) {
20 1
                $dependency->weaveAspects($spy, $pointcuts);
21
            }
22 1
            $log[] = sprintf(
23 1
                '%s => %s',
24 1
                $dependencyIndex,
25 1
                (string) $dependency
26
            );
27
        }
28 1
        sort($log);
29
30 1
        return implode(PHP_EOL, $log);
31
    }
32
}
33