@@ 85-102 (lines=18) @@ | ||
82 | * @param array|Expr ...$expressions |
|
83 | * @return $this |
|
84 | */ |
|
85 | public function addAnd($expression, ...$expressions) |
|
86 | { |
|
87 | if (! isset($this->query['$and'])) { |
|
88 | $this->query['$and'] = []; |
|
89 | } |
|
90 | ||
91 | $this->query['$and'] = array_merge( |
|
92 | $this->query['$and'], |
|
93 | array_map( |
|
94 | function ($expression) { |
|
95 | return $expression instanceof Expr ? $expression->getQuery() : $expression; |
|
96 | }, |
|
97 | func_get_args() |
|
98 | ) |
|
99 | ); |
|
100 | ||
101 | return $this; |
|
102 | } |
|
103 | ||
104 | /** |
|
105 | * Add one or more $nor clauses to the current query. |
|
@@ 113-125 (lines=13) @@ | ||
110 | * @param array|Expr ...$expressions |
|
111 | * @return $this |
|
112 | */ |
|
113 | public function addNor($expression, ...$expressions) |
|
114 | { |
|
115 | if (! isset($this->query['$nor'])) { |
|
116 | $this->query['$nor'] = []; |
|
117 | } |
|
118 | ||
119 | $this->query['$nor'] = array_merge( |
|
120 | $this->query['$nor'], |
|
121 | array_map(function ($expression) { |
|
122 | return $expression instanceof Expr ? $expression->getQuery() : $expression; |
|
123 | }, func_get_args()) |
|
124 | ); |
|
125 | ||
126 | return $this; |
|
127 | } |
|
128 | ||
@@ 138-150 (lines=13) @@ | ||
135 | * @param array|Expr ...$expressions |
|
136 | * @return $this |
|
137 | */ |
|
138 | public function addOr($expression, ...$expressions) |
|
139 | { |
|
140 | if (! isset($this->query['$or'])) { |
|
141 | $this->query['$or'] = []; |
|
142 | } |
|
143 | ||
144 | $this->query['$or'] = array_merge( |
|
145 | $this->query['$or'], |
|
146 | array_map(function ($expression) { |
|
147 | return $expression instanceof Expr ? $expression->getQuery() : $expression; |
|
148 | }, func_get_args()) |
|
149 | ); |
|
150 | ||
151 | return $this; |
|
152 | } |
|
153 |