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

Example::getCodeBlock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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