Passed
Pull Request — master (#681)
by Jonathan
02:01
created

VersionExecutionResult::setMemory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Migrations;
6
7
use Throwable;
8
use function count;
9
10
/**
11
 * @internal
12
 */
13
class VersionExecutionResult
14
{
15
    /** @var string[] */
16
    private $sql = [];
17
18
    /** @var mixed[] */
19
    private $params = [];
20
21
    /** @var mixed[] */
22
    private $types = [];
23
24
    /** @var null|float */
25
    private $time;
26
27
    /** @var null|float */
28
    private $memory;
29
30
    /** @var bool */
31
    private $skipped = false;
32
33
    /** @var bool */
34
    private $error = false;
35
36
    /** @var null|Throwable */
37
    private $exception;
38
39
    /**
40
     * @param string[] $sql
41
     * @param mixed[]  $params
42
     * @param mixed[]  $types
43
     */
44 67
    public function __construct(array $sql = [], array $params = [], array $types = [])
45
    {
46 67
        $this->sql    = $sql;
47 67
        $this->params = $params;
48 67
        $this->types  = $types;
49 67
    }
50
51 1
    public function hasSql() : bool
52
    {
53 1
        return count($this->sql) !== 0;
54
    }
55
56
    /**
57
     * @return string[]
58
     */
59 38
    public function getSql() : array
60
    {
61 38
        return $this->sql;
62
    }
63
64
    /**
65
     * @param string[] $sql
66
     */
67 52
    public function setSql(array $sql) : void
68
    {
69 52
        $this->sql = $sql;
70 52
    }
71
72
    /**
73
     * @return mixed[]
74
     */
75 12
    public function getParams() : array
76
    {
77 12
        return $this->params;
78
    }
79
80
    /**
81
     * @param mixed[] $params
82
     */
83 52
    public function setParams(array $params) : void
84
    {
85 52
        $this->params = $params;
86 52
    }
87
88
    /**
89
     * @return mixed[]
90
     */
91 3
    public function getTypes() : array
92
    {
93 3
        return $this->types;
94
    }
95
96
    /**
97
     * @param mixed[] $types
98
     */
99 52
    public function setTypes(array $types) : void
100
    {
101 52
        $this->types = $types;
102 52
    }
103
104 3
    public function getTime() : ?float
105
    {
106 3
        return $this->time;
107
    }
108
109 52
    public function setTime(float $time) : void
110
    {
111 52
        $this->time = $time;
112 52
    }
113
114 1
    public function getMemory() : ?float
115
    {
116 1
        return $this->memory;
117
    }
118
119 52
    public function setMemory(float $memory) : void
120
    {
121 52
        $this->memory = $memory;
122 52
    }
123
124 7
    public function setSkipped(bool $skipped) : void
125
    {
126 7
        $this->skipped = $skipped;
127 7
    }
128
129 1
    public function isSkipped() : bool
130
    {
131 1
        return $this->skipped;
132
    }
133
134 2
    public function setError(bool $error) : void
135
    {
136 2
        $this->error = $error;
137 2
    }
138
139 1
    public function hasError() : bool
140
    {
141 1
        return $this->error;
142
    }
143
144 2
    public function setException(Throwable $exception) : void
145
    {
146 2
        $this->exception = $exception;
147 2
    }
148
149 1
    public function getException() : ?Throwable
150
    {
151 1
        return $this->exception;
152
    }
153
}
154