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

DbalMigrationFactory::createVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
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