Completed
Pull Request — master (#925)
by Asmir
02:17
created

DbalMigrationFactory   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 __construct() 0 4 1
A createVersion() 0 5 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 DbalMigrationFactory class is responsible for creating instances of a migration class name for a DBAL connection.
13
 *
14
 * @var internal
15
 */
16
final class DbalMigrationFactory implements MigrationFactory
17
{
18
    /** @var Connection */
19
    private $connection;
20
21
    /** @var LoggerInterface */
22
    private $logger;
23
24 36
    public function __construct(Connection $connection, LoggerInterface $logger)
25
    {
26 36
        $this->connection = $connection;
27 36
        $this->logger     = $logger;
28 36
    }
29
30 1
    public function createVersion(string $migrationClassName) : AbstractMigration
31
    {
32 1
        return new $migrationClassName(
33 1
            $this->connection,
34 1
            $this->logger
35
        );
36
    }
37
}
38