Completed
Push — master ( a24de7...5bce41 )
by Kévin
03:41
created

EloquentVisitor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getCompilationData() 0 6 1
1
<?php
2
3
namespace RulerZ\Target\Eloquent;
4
5
use Hoa\Ruler\Model as AST;
6
7
use RulerZ\Compiler\Context;
8
use RulerZ\Target\GenericSqlVisitor;
9
use RulerZ\Target\Operators\Definitions as OperatorsDefinitions;
10
11
class EloquentVisitor extends GenericSqlVisitor
12
{
13
    /**
14
     * Allow eloquent builder as query.
15
     *
16
     * @var bool
17
     */
18
    protected $allowEloquentBuilderAsQuery = false;
19
20
    public function __construct(
21
        Context $context,
22
        OperatorsDefinitions $operators,
23
        $allowStarOperator = true,
24
        $allowEloquentBuilderAsQuery = false
25
    ) {
26
        parent::__construct($context, $operators, $allowStarOperator);
27
28
        $this->allowEloquentBuilderAsQuery = (bool) $allowEloquentBuilderAsQuery;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function getCompilationData()
35
    {
36
        return [
37
            'allowEloquentBuilderAsQuery ' => $this->allowEloquentBuilderAsQuery,
38
        ];
39
    }
40
}
41