GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractMigration   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 39
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
up() 0 1 ?
A __construct() 0 4 1
A getNumber() 0 8 3
A down() 0 3 1
1
<?php
2
/**
3
 * Starlit Db.
4
 *
5
 * @copyright Copyright (c) 2016 Starweb AB
6
 * @license   BSD 3-Clause
7
 */
8
9
namespace Starlit\Db\Migration;
10
11
use Starlit\Db\Db;
12
13
/**
14
 * Concrete migration class names must contain a sequential migration number, eg. "Migration1".
15
 *
16
 * Names can also include something more meaningful, eg. "Migration14CreateAuthorsTable".
17
 *
18
 * @author Andreas Nilsson <http://github.com/jandreasn>
19
 */
20
abstract class AbstractMigration
21
{
22
    /**
23
     * @var Db;
24
     */
25
    protected $db;
26
27
    /**
28
     * @param Db $db
29
     */
30 13
    final public function __construct(Db $db)
31
    {
32 13
        $this->db = $db;
33 13
    }
34
35
    /**
36
     * @return int
37
     */
38 10
    public function getNumber()
39
    {
40 10
        if (!preg_match('/\d+/', get_class($this), $matches) ||  !($number = (int) $matches[0])) {
41 1
            throw new \LogicException("Invalid migration class name (must include a migration number)");
42
        }
43
44 9
        return $number;
45
    }
46
47
    /**
48
     * Actions to be performed when migrating up to this version (e.g. 6.1.0 -> 6.2.0)
49
     */
50
    abstract public function up();
51
52
    /**
53
     * Actions to be performed when migrating down from this version (e.g. 6.2.0 -> 6.0.0)
54
     */
55 1
    public function down()
56
    {
57 1
    }
58
}
59