Property::getName()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Zalas\PHPUnit\Doubles\Extractor;
5
6
final class Property
7
{
8
    /**
9
     * @var string
10
     */
11
    private $name;
12
13
    /**
14
     * @var array|string[]
15
     */
16
    private $types;
17
18 24
    public function __construct(string $name, array $types)
19
    {
20 24
        $this->name = $name;
21 24
        $this->types = $types;
22
    }
23
24 21
    public function getName(): string
25
    {
26 21
        return $this->name;
27
    }
28
29 3
    public function getTypes(): array
30
    {
31 3
        return $this->types;
32
    }
33
34 19
    public function getTypesFiltered(callable $filter): array
35
    {
36 19
        return \array_filter($this->types, $filter);
37
    }
38
39 2
    public function hasType(string $type): bool
40
    {
41 2
        return \in_array($type, $this->types);
42
    }
43
}
44