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

DbVersionRepositoryFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A __construct() 0 3 1
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