OrLogic::__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
declare(strict_types=1);
3
4
namespace TBolier\RethinkQL\Query\Logic;
5
6
use TBolier\RethinkQL\Query\AbstractQuery;
7
use TBolier\RethinkQL\Query\Operation\OperationTrait;
8
use TBolier\RethinkQL\Query\QueryInterface;
9
use TBolier\RethinkQL\RethinkInterface;
10
use TBolier\RethinkQL\Types\Term\TermType;
11
12
class OrLogic extends AbstractQuery
13
{
14
    use OperationTrait;
15
16
    /**
17
     * @var QueryInterface
18
     */
19
    private $functionOne;
20
21
    /**
22
     * @var QueryInterface
23
     */
24
    private $functionTwo;
25
26
    public function __construct(
27
        RethinkInterface $rethink,
28
        QueryInterface $functionOne,
29
        QueryInterface $functionTwo
30
    ) {
31
        parent::__construct($rethink);
32
33
        $this->rethink = $rethink;
34
35
        $this->functionOne = $functionOne;
36
        $this->functionTwo = $functionTwo;
37
    }
38
39
    public function toArray(): array
40
    {
41
        return
42
            [
43
                TermType::OR,
44
                [
45
                    $this->functionOne->toArray(),
46
                    $this->functionTwo->toArray(),
47
                ],
48
            ];
49
    }
50
}
51