Test Failed
Push — master ( a52ae2...22d245 )
by Hannes
01:58
created

Example   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 52
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getCodeBlock() 0 3 1
A getExpectations() 0 3 1
A getName() 0 3 1
A isActive() 0 3 1
A withActive() 0 5 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\readmetester\Example;
6
7
use hanneskod\readmetester\Expectation\ExpectationInterface;
8
use hanneskod\readmetester\Name\NameInterface;
9
use hanneskod\readmetester\Parser\CodeBlock;
10
11
final class Example implements ExampleInterface
12
{
13
    /** @var bool */
14
    private $active = true;
15
16
    /** @var NameInterface */
17
    private $name;
18
19
    /** @var CodeBlock */
20
    private $code;
21
22
    /** @var ExpectationInterface[] */
23
    private $expectations;
24
25
    /**
26
     * @param ExpectationInterface[] $expectations
27
     */
28
    public function __construct(NameInterface $name, CodeBlock $code, array $expectations = [])
29
    {
30
        $this->name = $name;
31
        $this->code = $code;
32
        $this->expectations = $expectations;
33
    }
34
35
    public function getName(): NameInterface
36
    {
37
        return $this->name;
38
    }
39
40
    public function isActive(): bool
41
    {
42
        return $this->active;
43
    }
44
45
    public function withActive(bool $active): ExampleInterface
46
    {
47
        $new = clone $this;
48
        $new->active = $active;
49
        return $new;
50
    }
51
52
    public function getCodeBlock(): CodeBlock
53
    {
54
        return $this->code;
55
    }
56
57
    /**
58
     * @return ExpectationInterface[]
59
     */
60
    public function getExpectations(): array
61
    {
62
        return $this->expectations;
63
    }
64
}
65