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

Example   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 57
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 4 1
A getExpectations() 0 4 1
A getCodeBlock() 0 4 1
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