Completed
Push — master ( abec3a...7e1653 )
by Hannes
02:00
created

Example::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace hanneskod\readmetester;
4
5
use hanneskod\readmetester\Expectation\ExpectationInterface;
6
7
/**
8
 * Wrapper around a block of code and it's expectations
9
 */
10
class Example
11
{
12
    /**
13
     * @var string Name of this example
14
     */
15
    private $name;
16
17
    /**
18
     * @var CodeBlock Example code
19
     */
20
    private $code;
21
22
    /**
23
     * @var ExpectationInterface[] List of expectations
24
     */
25
    private $expectations;
26
27
    /**
28
     * @param string $name
29
     */
30
    public function __construct($name, CodeBlock $code, array $expectations)
31
    {
32
        $this->name = $name;
33
        $this->code = $code;
34
        $this->expectations = $expectations;
35
    }
36
37
    /**
38
     * Get name of example
39
     *
40
     * @return string
41
     */
42
    public function getName()
43
    {
44
        return $this->name;
45
    }
46
47
    /**
48
     * Get example code block
49
     *
50
     * @return CodeBlock
51
     */
52
    public function getCodeBlock()
53
    {
54
        return $this->code;
55
    }
56
57
    /**
58
     * Get registered expectations
59
     *
60
     * @return ExpectationInterface[]
61
     */
62
    public function getExpectations()
63
    {
64
        return $this->expectations;
65
    }
66
}
67