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

ModuleString   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 22
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 19 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