Passed
Push — master ( 229462...d74785 )
by Andreas
02:20 queued 14s
created

MigrationFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createVersion() 0 5 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Migrations\Version;
6
7
use Doctrine\DBAL\Connection;
8
use Doctrine\Migrations\AbstractMigration;
9
use Psr\Log\LoggerInterface;
10
11
/**
12
 * The MigrationFactory class is responsible for creating instances of the Version class for a version number
13
 * and a migration class name.
14
 *
15
 * @var internal
16
 */
17
/*final*/ class MigrationFactory
18
{
19
    /** @var Connection */
20
    private $connection;
21
22
    /** @var LoggerInterface */
23
    private $logger;
24
25 35
    public function __construct(Connection $connection, LoggerInterface $logger)
26
    {
27 35
        $this->connection = $connection;
28 35
        $this->logger     = $logger;
29 35
    }
30
31 1
    public function createVersion(string $migrationClassName) : AbstractMigration
32
    {
33 1
        return new $migrationClassName(
34 1
            $this->connection,
35 1
            $this->logger
36
        );
37
    }
38
}
39