OrLogic   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 12
c 1
b 0
f 0
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A toArray() 0 8 1
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