Passed
Pull Request — master (#3)
by Vincent
08:42
created

DbVersionRepositoryFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Bdf\PrimeBundle\Migration;
4
5
use Bdf\Prime\Migration\Version\DbVersionRepository;
6
use Bdf\Prime\ServiceLocator;
7
8
/**
9
 * Create an instance of DbVersionRepository
10
 */
11
class DbVersionRepositoryFactory
12
{
13
    /**
14
     * @var ServiceLocator
15
     */
16
    private $prime;
17
18
    /**
19
     * PrimeFactory constructor.
20
     *
21
     * @param ServiceLocator $prime
22
     */
23 1
    public function __construct(ServiceLocator $prime)
24
    {
25 1
        $this->prime = $prime;
26 1
    }
27
28
    /**
29
     * Create the repository instance
30
     *
31
     * @param string $tableName
32
     * @param string|null $connection
33
     *
34
     * @return DbVersionRepository
35
     */
36 1
    public function create(string $tableName, string $connection = null): DbVersionRepository
37
    {
38 1
        return new DbVersionRepository($this->prime->connection($connection), $tableName);
39
    }
40
}
41