Completed
Push — master ( 2f2a87...25acd6 )
by Alessandro
01:48
created

Builder::and()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php declare(strict_types = 1);
2
3
namespace Algatux\QueryBuilder;
4
5
use MongoDB\Collection;
6
7
/**
8
 * Class Builder.
9
 */
10
class Builder
11
{
12
    const COND_TYPE_AND = 1;
13
    const COND_TYPE_OR = 1;
14
15
    /** @var Collection */
16
    private $collection;
17
    /** @var Expression  */
18
    private $expression;
19
20
    /**
21
     * Builder constructor.
22
     *
23
     * @param Collection $collection
24
     */
25
    public function __construct(Collection $collection)
26
    {
27
        $this->collection = $collection;
28
        $this->expression = new Expression();
29
    }
30
31
    /**
32
     * @param array|Expression $expression
33
     *
34
     * @return $this
35
     */
36
    public function and($expression)
0 ignored issues
show
Unused Code introduced by
The parameter $expression is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
        $this->expression->and(...func_get_args());
39
40
        return $this;
41
    }
42
43
    /**
44
     * @param array|Expression $expression
45
     *
46
     * @return $this
47
     */
48
    public function or($expression)
0 ignored issues
show
Unused Code introduced by
The parameter $expression is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
    {
50
        $this->expression->or(...func_get_args());
51
52
        return $this;
53
    }
54
55
    /**
56
     * @return array
57
     */
58
    public function getQueryFilters(): array
59
    {
60
        return $this->expression->getQueryPartial();
61
    }
62
63
    /**
64
     * @return Expression
65
     */
66
    public function expr(): Expression
67
    {
68
        return new Expression();
69
    }
70
}