Arguments::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 8
ccs 7
cts 7
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\Compilation;
5
6
use Innmind\Compose\{
7
    Arguments as Container,
8
    Definition
9
};
10
use Innmind\Immutable\Set;
11
12
final class Arguments
13
{
14
    private $arguments;
15
16 9
    public function __construct(Container $arguments)
17
    {
18 9
        $this->arguments = $arguments
19 9
            ->all()
20 9
            ->reduce(
21 9
                Set::of(Argument::class),
22 9
                static function(Set $arguments, Definition\Argument $argument): Set {
23 5
                    return $arguments->add($argument->compile());
24 9
                }
25
            );
26 9
    }
27
28 7
    public function __toString(): string
29
    {
30 7
        return (string) $this->arguments->join("\n\n");
31
    }
32
}
33