Completed
Push — master ( 3c8585...bbfb28 )
by Hannes
05:06
created

Result   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getReturnValue() 0 4 1
A getOutput() 0 4 1
A getException() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\readmetester\Runner;
6
7
/**
8
 * Container for the result of an executed code block
9
 */
10
class Result
11
{
12
    /**
13
     * @var mixed Data return by executed code
14
     */
15
    private $returnValue;
16
17
    /**
18
     * @var string Output made by executed code
19
     */
20
    private $output;
21
22
    /**
23
     * @var \Exception Exception thrown by executed code
24
     */
25
    private $exception;
26
27
    /**
28
     * Construct result object
29
     *
30
     * @param mixed           $returnValue Data return by executed code
31
     * @param string          $output      Output made by executed code
32
     * @param \Exception|null $exception   Exception thrown by executed code
33
     */
34
    public function __construct($returnValue, string $output, \Exception $exception = null)
35
    {
36
        $this->returnValue = $returnValue;
37
        $this->output = $output;
38
        $this->exception = $exception;
39
    }
40
41
    /**
42
     * Get data returned by executed code
43
     *
44
     * @return mixed
45
     */
46
    public function getReturnValue()
47
    {
48
        return $this->returnValue;
49
    }
50
51
    /**
52
     * Get output made by executed code
53
     */
54
    public function getOutput(): string
55
    {
56
        return $this->output;
57
    }
58
59
    /**
60
     * Get exception thrown by executed code
61
     *
62
     * @return \Exception|null
63
     */
64
    public function getException()
65
    {
66
        return $this->exception;
67
    }
68
}
69