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

Set   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 19
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A accepts() 0 7 2
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