MySQLDataFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 38
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createData() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the CRUDlex package.
5
 *
6
 * (c) Philip Lehmann-Böhm <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CRUDlex;
13
14
use Doctrine\DBAL\Connection;
15
use League\Flysystem\FilesystemInterface;
16
17
/**
18
 * A factory implementation for MySQLData instances.
19
 */
20
class MySQLDataFactory implements DataFactoryInterface
21
{
22
23
    /**
24
     * Holds the Doctrine DBAL instance.
25
     * @var Connection
26
     */
27
    protected $database;
28
29
    /**
30
     * Flag whether to use UUIDs as primary key.
31
     * @var bool
32
     */
33
    protected $useUUIDs;
34
35
    /**
36
     * Constructor.
37
     *
38
     * @param $database
39
     * the Doctrine DBAL instance
40
     * @param $useUUIDs
41
     * flag whether to use UUIDs as primary key
42
     */
43 81
    public function __construct(Connection $database, $useUUIDs = false)
44
    {
45 81
        $this->database = $database;
46 81
        $this->useUUIDs = $useUUIDs;
47 81
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 79
    public function createData(EntityDefinition $definition, FilesystemInterface $filesystem)
53
    {
54 79
        return new MySQLData($definition, $filesystem, $this->database, $this->useUUIDs);
55
    }
56
57
}
58