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

Migration   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 6
c 2
b 1
f 1
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A add() 0 6 2
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