AndLogic::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 11
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace TBolier\RethinkQL\Query\Logic;
4
5
use TBolier\RethinkQL\Query\AbstractQuery;
6
use TBolier\RethinkQL\Query\Operation\OperationTrait;
7
use TBolier\RethinkQL\Query\QueryInterface;
8
use TBolier\RethinkQL\RethinkInterface;
9
use TBolier\RethinkQL\Types\Term\TermType;
10
11
class AndLogic extends AbstractQuery
12
{
13
    use OperationTrait;
14
15
    /**
16
     * @var QueryInterface
17
     */
18
    private $functionOne;
19
20
    /**
21
     * @var QueryInterface
22
     */
23
    private $functionTwo;
24
25
    public function __construct(
26
        RethinkInterface $rethink,
27
        QueryInterface $functionOne,
28
        QueryInterface $functionTwo
29
    ) {
30
        parent::__construct($rethink);
31
32
        $this->rethink = $rethink;
33
34
        $this->functionOne = $functionOne;
35
        $this->functionTwo = $functionTwo;
36
    }
37
38
    public function toArray(): array
39
    {
40
        return
41
            [
42
                TermType::AND,
43
                [
44
                    $this->functionOne->toArray(),
45
                    $this->functionTwo->toArray(),
46
                ],
47
            ];
48
    }
49
}
50