Sequence::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\Definition\Argument\Type;
5
6
use Innmind\Compose\{
7
    Definition\Argument\Type,
8
    Exception\ValueNotSupported
9
};
10
use Innmind\Immutable\{
11
    SequenceInterface,
12
    Str
13
};
14
15
final class Sequence implements Type
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 2
    public function accepts($value): bool
21
    {
22 2
        return $value instanceof SequenceInterface;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 14
    public static function fromString(Str $value): Type
29
    {
30 14
        if ((string) $value !== 'sequence') {
31 12
            throw new ValueNotSupported((string) $value);
32
        }
33
34 2
        return new self;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    public function __toString(): string
41
    {
42 1
        return 'sequence';
43
    }
44
}
45