Completed
Push — master ( ad3a38...ce24f7 )
by Beniamin
02:38
created

QueryFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildQuery() 0 10 2
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
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 Phuria\SQLBuilder\Query;
13
14
use Phuria\SQLBuilder\Connection\ConnectionInterface;
15
use Phuria\SQLBuilder\Connection\ConnectionManagerInterface;
16
use Phuria\SQLBuilder\Parameter\ParameterManagerInterface;
17
18
/**
19
 * @author Beniamin Jonatan Šimko <[email protected]>
20
 */
21
class QueryFactory implements QueryFactoryInterface
22
{
23
    /**
24
     * @var ConnectionManagerInterface
25
     */
26
    private $connectionManager;
27
28
    /**
29
     * @param ConnectionManagerInterface $connectionManager
30
     */
31 37
    public function __construct(ConnectionManagerInterface $connectionManager)
32
    {
33 37
        $this->connectionManager = $connectionManager;
34 37
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39 15
    public function buildQuery($SQL, ParameterManagerInterface $parameterManager, $connectionHint = null)
40
    {
41 15
        if ($connectionHint instanceof ConnectionInterface) {
42 3
            $connection = $connectionHint;
43 3
        } else {
44 12
            $connection = $this->connectionManager->getConnection($connectionHint);
45
        }
46
47 15
        return new Query($SQL, $parameterManager, $connection);
0 ignored issues
show
Coding Style introduced by
$SQL does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
48
    }
49
}
50