Failed Conditions
Push — master ( 0469de...12f4fc )
by Jonathan
02:19
created

VersionExecutionResult::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
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
 * @var internal
12
 */
13
final 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 bool */
28
    private $skipped = false;
29
30
    /** @var bool */
31
    private $error = false;
32
33
    /** @var null|Throwable */
34
    private $exception;
35
36
    /**
37
     * @param string[] $sql
38
     * @param mixed[]  $params
39
     * @param mixed[]  $types
40
     */
41 67
    public function __construct(array $sql = [], array $params = [], array $types = [])
42
    {
43 67
        $this->sql    = $sql;
44 67
        $this->params = $params;
45 67
        $this->types  = $types;
46 67
    }
47
48 1
    public function hasSql() : bool
49
    {
50 1
        return count($this->sql) !== 0;
51
    }
52
53
    /**
54
     * @return string[]
55
     */
56 38
    public function getSql() : array
57
    {
58 38
        return $this->sql;
59
    }
60
61
    /**
62
     * @param string[] $sql
63
     */
64 51
    public function setSql(array $sql) : void
65
    {
66 51
        $this->sql = $sql;
67 51
    }
68
69
    /**
70
     * @return mixed[]
71
     */
72 12
    public function getParams() : array
73
    {
74 12
        return $this->params;
75
    }
76
77
    /**
78
     * @param mixed[] $params
79
     */
80 51
    public function setParams(array $params) : void
81
    {
82 51
        $this->params = $params;
83 51
    }
84
85
    /**
86
     * @return mixed[]
87
     */
88 3
    public function getTypes() : array
89
    {
90 3
        return $this->types;
91
    }
92
93
    /**
94
     * @param mixed[] $types
95
     */
96 51
    public function setTypes(array $types) : void
97
    {
98 51
        $this->types = $types;
99 51
    }
100
101 29
    public function getTime() : ?float
102
    {
103 29
        return $this->time;
104
    }
105
106 51
    public function setTime(float $time) : void
107
    {
108 51
        $this->time = $time;
109 51
    }
110
111 7
    public function setSkipped(bool $skipped) : void
112
    {
113 7
        $this->skipped = $skipped;
114 7
    }
115
116 1
    public function isSkipped() : bool
117
    {
118 1
        return $this->skipped;
119
    }
120
121 2
    public function setError(bool $error) : void
122
    {
123 2
        $this->error = $error;
124 2
    }
125
126 1
    public function hasError() : bool
127
    {
128 1
        return $this->error;
129
    }
130
131 2
    public function setException(Throwable $exception) : void
132
    {
133 2
        $this->exception = $exception;
134 2
    }
135
136 1
    public function getException() : ?Throwable
137
    {
138 1
        return $this->exception;
139
    }
140
}
141