Completed
Push — develop ( b9b8dc...f49312 )
by Baptiste
02:08
created

Decorate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
dl 0
loc 22
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 5 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
    Definitions,
9
    Exception\ValueNotSupported,
10
    Exception\DecoratedArgumentCannotBeResolved
11
};
12
use Innmind\Immutable\StreamInterface;
13
14
final class Decorate implements Argument
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19 5
    public static function fromValue($value): Argument
20
    {
21 5
        if ($value !== '@decorated') {
22 1
            throw new ValueNotSupported;
23
        }
24
25 4
        return new self;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 1
    public function resolve(
32
        StreamInterface $built,
33
        Definitions $definitions
34
    ): StreamInterface {
35 1
        throw new DecoratedArgumentCannotBeResolved;
36
    }
37
}
38