Passed
Push — v4.1 ( 4d3fc3...8dac2f )
by Masiukevich
01:26
created

Migration::add()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 3
c 1
b 0
f 1
nc 2
nop 2
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
/**
4
 * SQL databases adapters implementation.
5
 *
6
 * @author  Maksim Masiukevich <[email protected]>
7
 * @license MIT
8
 * @license https://opensource.org/licenses/MIT
9
 */
10
11
declare(strict_types = 1);
12
13
namespace ServiceBus\Storage\Sql\Migration;
14
15
/**
16
 *
17
 */
18
abstract class Migration
19
{
20
    /** @var array */
21
    private $queries = [];
22
23
    /**
24
     * @psaln-var array<string, array>
25
     *
26
     * @var array
27
     */
28
    private $params = [];
29
30 3
    final public function __construct()
31
    {
32 3
    }
33
34 2
    final protected function add(string $query, array $params = []): void
35
    {
36 2
        if ($query !== '')
37
        {
38 2
            $this->queries[]             = $query;
39 2
            $this->params[\sha1($query)] = $params;
40
        }
41 2
    }
42
43
    abstract protected function up(): void;
44
45
    abstract protected function down(): void;
46
}
47