Completed
Push — develop ( 15ec3c...8b62a8 )
by Baptiste
02:19
created

Decorate   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 5 1
A compile() 0 3 1
A fromValue() 0 7 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\Definition\Service\Argument;
5
6
use Innmind\Compose\{
7
    Definition\Service\Argument,
8
    Definition\Service\Arguments,
9
    Services,
10
    Compilation\Service\Argument as CompiledArgument,
11
    Exception\ValueNotSupported,
12
    Exception\DecoratedArgumentCannotBeResolved,
13
    Exception\DecoratedArgumentCannotBeCompiled
14
};
15
use Innmind\Immutable\StreamInterface;
16
17
final class Decorate implements Argument
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 33
    public static function fromValue($value, Arguments $arguments): Argument
23
    {
24 33
        if ($value !== '@decorated') {
25 23
            throw new ValueNotSupported;
26
        }
27
28 18
        return new self;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    public function resolve(
35
        StreamInterface $built,
36
        Services $services
37
    ): StreamInterface {
38 1
        throw new DecoratedArgumentCannotBeResolved;
39
    }
40
41 1
    public function compile(): CompiledArgument
42
    {
43 1
        throw new DecoratedArgumentCannotBeCompiled;
44
    }
45
}
46