InterpreterFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Netdudes\DataSourceryBundle\UQL;
4
5
use Netdudes\DataSourceryBundle\DataSource\DataSourceInterface;
6
use Netdudes\DataSourceryBundle\Extension\ContextFactory;
7
use Netdudes\DataSourceryBundle\Extension\UqlExtensionContainer;
8
use Netdudes\DataSourceryBundle\Query\FilterConditionFactory;
9
10
class InterpreterFactory
11
{
12
    /**
13
     * @var UqlExtensionContainer
14
     */
15
    private $extensionContainer;
16
17
    /**
18
     * @var FilterConditionFactory
19
     */
20
    private $filterConditionFactory;
21
22
    /**
23
     * @var ContextFactory
24
     */
25
    private $contextFactory;
26
27
    /**
28
     * @var bool
29
     */
30
    private $caseSensitive;
31
32
    /**
33
     * @param UqlExtensionContainer  $extensionContainer
34
     * @param FilterConditionFactory $filterConditionFactory
35
     * @param ContextFactory         $contextFactory
36
     * @param bool                   $caseSensitive
37
     */
38
    public function __construct(
39
        UqlExtensionContainer $extensionContainer,
40
        FilterConditionFactory $filterConditionFactory,
41
        ContextFactory $contextFactory,
42
        $caseSensitive = true
43
    ) {
44
        $this->extensionContainer = $extensionContainer;
45
        $this->caseSensitive = $caseSensitive;
46
        $this->filterConditionFactory = $filterConditionFactory;
47
        $this->contextFactory = $contextFactory;
48
    }
49
50
    /**
51
     * @param DataSourceInterface $dataSource
52
     *
53
     * @return Interpreter
54
     */
55
    public function create(DataSourceInterface $dataSource)
56
    {
57
        return new Interpreter($this->extensionContainer, $dataSource, $this->filterConditionFactory, $this->contextFactory, $this->caseSensitive);
58
    }
59
}
60