Total Complexity | 7 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class MigrationPlan |
||
13 | { |
||
14 | /** @var string */ |
||
15 | private $direction; |
||
16 | /** @var Version */ |
||
17 | private $version; |
||
18 | /** @var AbstractMigration */ |
||
19 | private $migration; |
||
20 | |||
21 | /** @var ExecutionResult */ |
||
22 | public $result; |
||
23 | |||
24 | 42 | public function __construct(Version $version, AbstractMigration $migration, string $direction) |
|
25 | { |
||
26 | 42 | $this->version = $version; |
|
27 | 42 | $this->migration = $migration; |
|
28 | 42 | $this->direction = $direction; |
|
29 | 42 | } |
|
30 | |||
31 | 22 | public function getVersion() : Version |
|
32 | { |
||
33 | 22 | return $this->version; |
|
34 | } |
||
35 | |||
36 | 3 | public function getResult() : ?ExecutionResult |
|
37 | { |
||
38 | 3 | return $this->result; |
|
39 | } |
||
40 | |||
41 | 12 | public function markAsExecuted(ExecutionResult $result) : void |
|
42 | { |
||
43 | 12 | if ($this->result !== null) { |
|
44 | 1 | throw PlanAlreadyExecuted::new(); |
|
45 | } |
||
46 | |||
47 | 12 | $this->result = $result; |
|
48 | 12 | } |
|
49 | |||
50 | 11 | public function getMigration() : AbstractMigration |
|
51 | { |
||
52 | 11 | return $this->migration; |
|
53 | } |
||
54 | |||
55 | 22 | public function getDirection() : string |
|
58 | } |
||
59 | } |
||
60 |