Completed
Push — develop ( 523088...d9cee5 )
by Baptiste
01:42
created

Set::accepts()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
crap 2.0625
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Compose\Definition\Argument\Type;
5
6
use Innmind\Compose\Definition\Argument\Type;
7
use Innmind\Immutable\SetInterface;
8
9
final class Set implements Type
10
{
11
    private $type;
12
13 2
    public function __construct(string $type)
14
    {
15 2
        $this->type = $type;
16 2
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 1
    public function accepts($value): bool
22
    {
23 1
        if (!$value instanceof SetInterface) {
24
            return false;
25
        }
26
27 1
        return (string) $value->type() === $this->type;
28
    }
29
}
30