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