Operator::eq()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ODM\MongoDB\Aggregation\Stage;
6
7
use Doctrine\ODM\MongoDB\Aggregation\Builder;
8
use Doctrine\ODM\MongoDB\Aggregation\Expr;
9
use Doctrine\ODM\MongoDB\Aggregation\Stage;
10
use function func_get_args;
11
12
/**
13
 * Fluent interface for adding operators to aggregation stages.
14
 *
15
 * @method $this switch()
16
 * @method $this case(mixed|Expr $expression)
17
 * @method $this then(mixed|Expr $expression)
18
 * @method $this default(mixed|Expr $expression)
19
 */
20
abstract class Operator extends Stage
21
{
22
    /** @var Expr */
23
    protected $expr;
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 152
    public function __construct(Builder $builder)
29
    {
30 152
        parent::__construct($builder);
31
32 152
        $this->expr = $builder->expr();
33 152
    }
34
35 5
    public function __call(string $method, array $args) : self
36
    {
37 5
        $this->expr->$method(...$args);
38
39 2
        return $this;
40
    }
41
42
    /**
43
     * Returns the absolute value of a number.
44
     *
45
     * The <number> argument can be any valid expression as long as it resolves
46
     * to a number.
47
     *
48
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/abs/
49
     * @see Expr::abs
50
     *
51
     * @param mixed|Expr $number
52
     */
53 1
    public function abs($number) : self
54
    {
55 1
        $this->expr->abs($number);
56
57 1
        return $this;
58
    }
59
60
    /**
61
     * Adds numbers together or adds numbers and a date. If one of the arguments
62
     * is a date, $add treats the other arguments as milliseconds to add to the
63
     * date.
64
     *
65
     * The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date.
66
     *
67
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/add/
68
     * @see Expr::add
69
     *
70
     * @param mixed|Expr $expression1
71
     * @param mixed|Expr $expression2
72
     * @param mixed|Expr ...$expressions Additional expressions
73
     */
74 2
    public function add($expression1, $expression2, ...$expressions) : self
0 ignored issues
show
Unused Code introduced by
The parameter $expression1 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...
Unused Code introduced by
The parameter $expression2 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...
Unused Code introduced by
The parameter $expressions 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...
75
    {
76 2
        $this->expr->add(...func_get_args());
77
78 2
        return $this;
79
    }
80
81
    /**
82
     * Add one or more $and clauses to the current expression.
83
     *
84
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/and/
85
     * @see Expr::addAnd
86
     *
87
     * @param array|Expr $expression
88
     * @param array|Expr ...$expressions
89
     */
90
    public function addAnd($expression, ...$expressions) : self
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...
Unused Code introduced by
The parameter $expressions 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...
91
    {
92
        $this->expr->addAnd(...func_get_args());
93
94
        return $this;
95
    }
96
97
    /**
98
     * Add one or more $or clauses to the current expression.
99
     *
100
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/or/
101
     * @see Expr::addOr
102
     *
103
     * @param array|Expr $expression
104
     * @param array|Expr ...$expressions
105
     */
106
    public function addOr($expression, ...$expressions) : self
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...
Unused Code introduced by
The parameter $expressions 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...
107
    {
108
        $this->expr->addOr(...func_get_args());
109
110
        return $this;
111
    }
112
113
    /**
114
     * Evaluates an array as a set and returns true if no element in the array
115
     * is false. Otherwise, returns false. An empty array returns true.
116
     *
117
     * The expression must resolve to an array.
118
     *
119
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/allElementsTrue/
120
     * @see Expr::allElementsTrue
121
     *
122
     * @param mixed|Expr $expression
123
     */
124 1
    public function allElementsTrue($expression) : self
125
    {
126 1
        $this->expr->allElementsTrue($expression);
127
128 1
        return $this;
129
    }
130
131
    /**
132
     * Evaluates an array as a set and returns true if any of the elements are
133
     * true and false otherwise. An empty array returns false.
134
     *
135
     * The expression must resolve to an array.
136
     *
137
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/anyElementTrue/
138
     * @see Expr::anyElementTrue
139
     *
140
     * @param array|Expr $expression
141
     */
142 1
    public function anyElementTrue($expression) : self
143
    {
144 1
        $this->expr->anyElementTrue($expression);
145
146 1
        return $this;
147
    }
148
149
    /**
150
     * Returns the element at the specified array index.
151
     *
152
     * The <array> expression can be any valid expression as long as it resolves
153
     * to an array.
154
     * The <idx> expression can be any valid expression as long as it resolves
155
     * to an integer.
156
     *
157
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/arrayElemAt/
158
     * @see Expr::arrayElemAt
159
     *
160
     * @param mixed|Expr $array
161
     * @param mixed|Expr $index
162
     */
163 1
    public function arrayElemAt($array, $index) : self
164
    {
165 1
        $this->expr->arrayElemAt($array, $index);
166
167 1
        return $this;
168
    }
169
170
    /**
171
     * Returns the smallest integer greater than or equal to the specified number.
172
     *
173
     * The <number> expression can be any valid expression as long as it
174
     * resolves to a number.
175
     *
176
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/ceil/
177
     * @see Expr::ceil
178
     *
179
     * @param mixed|Expr $number
180
     */
181 1
    public function ceil($number) : self
182
    {
183 1
        $this->expr->ceil($number);
184
185 1
        return $this;
186
    }
187
188
    /**
189
     * Compares two values and returns:
190
     * -1 if the first value is less than the second.
191
     * 1 if the first value is greater than the second.
192
     * 0 if the two values are equivalent.
193
     *
194
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/cmp/
195
     * @see Expr::cmp
196
     *
197
     * @param mixed|Expr $expression1
198
     * @param mixed|Expr $expression2
199
     */
200 1
    public function cmp($expression1, $expression2) : self
201
    {
202 1
        $this->expr->cmp($expression1, $expression2);
203
204 1
        return $this;
205
    }
206
207
    /**
208
     * Concatenates strings and returns the concatenated string.
209
     *
210
     * The arguments can be any valid expression as long as they resolve to
211
     * strings. If the argument resolves to a value of null or refers to a field
212
     * that is missing, $concat returns null.
213
     *
214
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/concat/
215
     * @see Expr::concat
216
     *
217
     * @param mixed|Expr $expression1
218
     * @param mixed|Expr $expression2
219
     * @param mixed|Expr ...$expressions Additional expressions
220
     */
221 3
    public function concat($expression1, $expression2, ...$expressions) : self
0 ignored issues
show
Unused Code introduced by
The parameter $expression1 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...
Unused Code introduced by
The parameter $expression2 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...
Unused Code introduced by
The parameter $expressions 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...
222
    {
223 3
        $this->expr->concat(...func_get_args());
224
225 3
        return $this;
226
    }
227
228
    /**
229
     * Concatenates arrays to return the concatenated array.
230
     *
231
     * The <array> expressions can be any valid expression as long as they
232
     * resolve to an array.
233
     *
234
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/concatArrays/
235
     * @see Expr::concatArrays
236
     *
237
     * @param mixed|Expr $array1
238
     * @param mixed|Expr $array2
239
     * @param mixed|Expr ...$arrays Additional expressions
240
     */
241 2
    public function concatArrays($array1, $array2, ...$arrays) : self
0 ignored issues
show
Unused Code introduced by
The parameter $array1 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...
Unused Code introduced by
The parameter $array2 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...
Unused Code introduced by
The parameter $arrays 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...
242
    {
243 2
        $this->expr->concatArrays(...func_get_args());
244
245 2
        return $this;
246
    }
247
248
    /**
249
     * Evaluates a boolean expression to return one of the two specified return
250
     * expressions.
251
     *
252
     * The arguments can be any valid expression.
253
     *
254
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/cond/
255
     * @see Expr::cond
256
     *
257
     * @param mixed|Expr $if
258
     * @param mixed|Expr $then
259
     * @param mixed|Expr $else
260
     */
261 4
    public function cond($if, $then, $else) : self
262
    {
263 4
        $this->expr->cond($if, $then, $else);
264
265 4
        return $this;
266
    }
267
268
    /**
269
     * Converts a date object to a string according to a user-specified format.
270
     *
271
     * The format string can be any string literal, containing 0 or more format
272
     * specifiers.
273
     * The date argument can be any expression as long as it resolves to a date.
274
     *
275
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/dateToString/
276
     * @see Expr::dateToString
277
     *
278
     * @param string     $format
279
     * @param mixed|Expr $expression
280
     */
281 1
    public function dateToString($format, $expression) : self
282
    {
283 1
        $this->expr->dateToString($format, $expression);
284
285 1
        return $this;
286
    }
287
288
    /**
289
     * Returns the day of the month for a date as a number between 1 and 31.
290
     *
291
     * The argument can be any expression as long as it resolves to a date.
292
     *
293
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/dayOfMonth/
294
     * @see Expr::dayOfMonth
295
     *
296
     * @param mixed|Expr $expression
297
     */
298 1
    public function dayOfMonth($expression) : self
299
    {
300 1
        $this->expr->dayOfMonth($expression);
301
302 1
        return $this;
303
    }
304
305
    /**
306
     * Returns the day of the week for a date as a number between 1 (Sunday) and
307
     * 7 (Saturday).
308
     *
309
     * The argument can be any expression as long as it resolves to a date.
310
     *
311
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/dayOfWeek/
312
     * @see Expr::dayOfWeek
313
     *
314
     * @param mixed|Expr $expression
315
     */
316 1
    public function dayOfWeek($expression) : self
317
    {
318 1
        $this->expr->dayOfWeek($expression);
319
320 1
        return $this;
321
    }
322
323
    /**
324
     * Returns the day of the year for a date as a number between 1 and 366.
325
     *
326
     * The argument can be any expression as long as it resolves to a date.
327
     *
328
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/dayOfYear/
329
     * @see Expr::dayOfYear
330
     *
331
     * @param mixed|Expr $expression
332
     */
333 1
    public function dayOfYear($expression) : self
334
    {
335 1
        $this->expr->dayOfYear($expression);
336
337 1
        return $this;
338
    }
339
340
    /**
341
     * Divides one number by another and returns the result. The first argument
342
     * is divided by the second argument.
343
     *
344
     * The arguments can be any valid expression as long as the resolve to numbers.
345
     *
346
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/divide/
347
     * @see Expr::divide
348
     *
349
     * @param mixed|Expr $expression1
350
     * @param mixed|Expr $expression2
351
     */
352 1
    public function divide($expression1, $expression2) : self
353
    {
354 1
        $this->expr->divide($expression1, $expression2);
355
356 1
        return $this;
357
    }
358
359
    /**
360
     * Compares two values and returns whether they are equivalent.
361
     *
362
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/eq/
363
     * @see Expr::eq
364
     *
365
     * @param mixed|Expr $expression1
366
     * @param mixed|Expr $expression2
367
     */
368 3
    public function eq($expression1, $expression2) : self
369
    {
370 3
        $this->expr->eq($expression1, $expression2);
371
372 3
        return $this;
373
    }
374
375
    /**
376
     * Raises Euler’s number to the specified exponent and returns the result.
377
     *
378
     * The <exponent> expression can be any valid expression as long as it
379
     * resolves to a number.
380
     *
381
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/exp/
382
     * @see Expr::exp
383
     *
384
     * @param mixed|Expr $exponent
385
     */
386 1
    public function exp($exponent) : self
387
    {
388 1
        $this->expr->exp($exponent);
389
390 1
        return $this;
391
    }
392
393
    /**
394
     * Used to use an expression as field value. Can be any expression
395
     *
396
     * @see http://docs.mongodb.org/manual/meta/aggregation-quick-reference/#aggregation-expressions
397
     * @see Expr::expression
398
     *
399
     * @param mixed|Expr $value
400
     */
401 17
    public function expression($value)
402
    {
403 17
        $this->expr->expression($value);
404
405 17
        return $this;
406
    }
407
408
    /**
409
     * Set the current field for building the expression.
410
     *
411
     * @see Expr::field
412
     */
413 28
    public function field(string $fieldName)
414
    {
415 28
        $this->expr->field($fieldName);
416
417 28
        return $this;
418
    }
419
420
    /**
421
     * Selects a subset of the array to return based on the specified condition.
422
     *
423
     * Returns an array with only those elements that match the condition. The
424
     * returned elements are in the original order.
425
     *
426
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/filter/
427
     * @see Expr::filter
428
     *
429
     * @param mixed|Expr $input
430
     * @param mixed|Expr $as
431
     * @param mixed|Expr $cond
432
     */
433 1
    public function filter($input, $as, $cond) : self
434
    {
435 1
        $this->expr->filter($input, $as, $cond);
436
437 1
        return $this;
438
    }
439
440
    /**
441
     * Returns the largest integer less than or equal to the specified number.
442
     *
443
     * The <number> expression can be any valid expression as long as it
444
     * resolves to a number.
445
     *
446
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/floor/
447
     * @see Expr::floor
448
     *
449
     * @param mixed|Expr $number
450
     */
451 1
    public function floor($number) : self
452
    {
453 1
        $this->expr->floor($number);
454
455 1
        return $this;
456
    }
457
458
    /**
459
     * Compares two values and returns:
460
     * true when the first value is greater than the second value.
461
     * false when the first value is less than or equivalent to the second value.
462
     *
463
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/gt/
464
     * @see Expr::gt
465
     *
466
     * @param mixed|Expr $expression1
467
     * @param mixed|Expr $expression2
468
     */
469 1
    public function gt($expression1, $expression2) : self
470
    {
471 1
        $this->expr->gt($expression1, $expression2);
472
473 1
        return $this;
474
    }
475
476
    /**
477
     * Compares two values and returns:
478
     * true when the first value is greater than or equivalent to the second value.
479
     * false when the first value is less than the second value.
480
     *
481
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/gte/
482
     * @see Expr::gte
483
     *
484
     * @param mixed|Expr $expression1
485
     * @param mixed|Expr $expression2
486
     */
487 1
    public function gte($expression1, $expression2) : self
488
    {
489 1
        $this->expr->gte($expression1, $expression2);
490
491 1
        return $this;
492
    }
493
494
    /**
495
     * Returns the hour portion of a date as a number between 0 and 23.
496
     *
497
     * The argument can be any expression as long as it resolves to a date.
498
     *
499
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/hour/
500
     * @see Expr::hour
501
     *
502
     * @param mixed|Expr $expression
503
     */
504 1
    public function hour($expression) : self
505
    {
506 1
        $this->expr->hour($expression);
507
508 1
        return $this;
509
    }
510
511
    /**
512
     * Returns a boolean indicating whether a specified value is in an array.
513
     *
514
     * Unlike the $in query operator, the aggregation $in operator does not
515
     * support matching by regular expressions.
516
     *
517
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/in/
518
     * @see Expr::in
519
     *
520
     * @param mixed|Expr $expression
521
     * @param mixed|Expr $arrayExpression
522
     */
523 1
    public function in($expression, $arrayExpression) : self
524
    {
525 1
        $this->expr->in($expression, $arrayExpression);
526
527 1
        return $this;
528
    }
529
530
    /**
531
     * Searches an array for an occurrence of a specified value and returns the
532
     * array index (zero-based) of the first occurrence. If the value is not
533
     * found, returns -1.
534
     *
535
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/indexOfArray/
536
     * @see Expr::indexOfArray
537
     *
538
     * @param mixed|Expr $arrayExpression  Can be any valid expression as long as it resolves to an array.
539
     * @param mixed|Expr $searchExpression Can be any valid expression.
540
     * @param mixed|Expr $start            Optional. An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number.
541
     * @param mixed|Expr $end              An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number.
542
     */
543 4
    public function indexOfArray($arrayExpression, $searchExpression, $start = null, $end = null) : self
544
    {
545 4
        $this->expr->indexOfArray($arrayExpression, $searchExpression, $start, $end);
546
547 4
        return $this;
548
    }
549
550
    /**
551
     * Searches a string for an occurrence of a substring and returns the UTF-8
552
     * byte index (zero-based) of the first occurrence. If the substring is not
553
     * found, returns -1.
554
     *
555
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/indexOfBytes/
556
     *
557
     * @param mixed|Expr      $stringExpression    Can be any valid expression as long as it resolves to a string.
558
     * @param mixed|Expr      $substringExpression Can be any valid expression as long as it resolves to a string.
559
     * @param string|int|null $start               An integral number that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number.
560
     * @param string|int|null $end                 An integral number that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number.
561
     */
562 4
    public function indexOfBytes($stringExpression, $substringExpression, $start = null, $end = null) : self
563
    {
564 4
        $this->expr->indexOfBytes($stringExpression, $substringExpression, $start, $end);
565
566 4
        return $this;
567
    }
568
569
    /**
570
     * Searches a string for an occurrence of a substring and returns the UTF-8
571
     * code point index (zero-based) of the first occurrence. If the substring is
572
     * not found, returns -1.
573
     *
574
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/indexOfCP/
575
     *
576
     * @param mixed|Expr      $stringExpression    Can be any valid expression as long as it resolves to a string.
577
     * @param mixed|Expr      $substringExpression Can be any valid expression as long as it resolves to a string.
578
     * @param string|int|null $start               An integral number that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number.
579
     * @param string|int|null $end                 An integral number that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number.
580
     */
581 4
    public function indexOfCP($stringExpression, $substringExpression, $start = null, $end = null) : self
582
    {
583 4
        $this->expr->indexOfCP($stringExpression, $substringExpression, $start, $end);
584
585 4
        return $this;
586
    }
587
588
    /**
589
     * Evaluates an expression and returns the value of the expression if the
590
     * expression evaluates to a non-null value. If the expression evaluates to
591
     * a null value, including instances of undefined values or missing fields,
592
     * returns the value of the replacement expression.
593
     *
594
     * The arguments can be any valid expression.
595
     *
596
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/ifNull/
597
     * @see Expr::ifNull
598
     *
599
     * @param mixed|Expr $expression
600
     * @param mixed|Expr $replacementExpression
601
     */
602 1
    public function ifNull($expression, $replacementExpression) : self
603
    {
604 1
        $this->expr->ifNull($expression, $replacementExpression);
605
606 1
        return $this;
607
    }
608
609
    /**
610
     * Determines if the operand is an array. Returns a boolean.
611
     *
612
     * The <expression> can be any valid expression.
613
     *
614
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/isArray/
615
     * @see Expr::isArray
616
     *
617
     * @param mixed|Expr $expression
618
     */
619 1
    public function isArray($expression) : self
620
    {
621 1
        $this->expr->isArray($expression);
622
623 1
        return $this;
624
    }
625
626
    /**
627
     * Returns the weekday number in ISO 8601 format, ranging from 1 (for Monday)
628
     * to 7 (for Sunday).
629
     *
630
     * The argument can be any expression as long as it resolves to a date.
631
     *
632
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/isoDayOfWeek/
633
     *
634
     * @param mixed|Expr $expression
635
     */
636 1
    public function isoDayOfWeek($expression) : self
637
    {
638 1
        $this->expr->isoDayOfWeek($expression);
639
640 1
        return $this;
641
    }
642
643
    /**
644
     * Returns the week number in ISO 8601 format, ranging from 1 to 53.
645
     *
646
     * Week numbers start at 1 with the week (Monday through Sunday) that
647
     * contains the year’s first Thursday.
648
     *
649
     * The argument can be any expression as long as it resolves to a date.
650
     *
651
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/isoWeek/
652
     *
653
     * @param mixed|Expr $expression
654
     */
655 1
    public function isoWeek($expression) : self
656
    {
657 1
        $this->expr->isoWeek($expression);
658
659 1
        return $this;
660
    }
661
662
    /**
663
     * Returns the year number in ISO 8601 format.
664
     *
665
     * The year starts with the Monday of week 1 (ISO 8601) and ends with the
666
     * Sunday of the last week (ISO 8601).
667
     *
668
     * The argument can be any expression as long as it resolves to a date.
669
     *
670
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/isoWeek/
671
     *
672
     * @param mixed|Expr $expression
673
     */
674 1
    public function isoWeekYear($expression) : self
675
    {
676 1
        $this->expr->isoWeekYear($expression);
677
678 1
        return $this;
679
    }
680
681
    /**
682
     * Binds variables for use in the specified expression, and returns the
683
     * result of the expression.
684
     *
685
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/let/
686
     * @see Expr::let
687
     *
688
     * @param mixed|Expr $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value.
689
     * @param mixed|Expr $in   The expression to evaluate.
690
     */
691 1
    public function let($vars, $in) : self
692
    {
693 1
        $this->expr->let($vars, $in);
694
695 1
        return $this;
696
    }
697
698
    /**
699
     * Returns a value without parsing. Use for values that the aggregation
700
     * pipeline may interpret as an expression.
701
     *
702
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/literal/
703
     * @see Expr::literal
704
     *
705
     * @param mixed|Expr $value
706
     */
707 1
    public function literal($value) : self
708
    {
709 1
        $this->expr->literal($value);
710
711 1
        return $this;
712
    }
713
714
    /**
715
     * Calculates the natural logarithm ln (i.e loge) of a number and returns
716
     * the result as a double.
717
     *
718
     * The <number> expression can be any valid expression as long as it
719
     * resolves to a non-negative number.
720
     *
721
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/log/
722
     * @see Expr::ln
723
     *
724
     * @param mixed|Expr $number
725
     */
726 1
    public function ln($number) : self
727
    {
728 1
        $this->expr->ln($number);
729
730 1
        return $this;
731
    }
732
733
    /**
734
     * Calculates the log of a number in the specified base and returns the
735
     * result as a double.
736
     *
737
     * The <number> expression can be any valid expression as long as it
738
     * resolves to a non-negative number.
739
     * The <base> expression can be any valid expression as long as it resolves
740
     * to a positive number greater than 1.
741
     *
742
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/log/
743
     * @see Expr::log
744
     *
745
     * @param mixed|Expr $number
746
     * @param mixed|Expr $base
747
     */
748 1
    public function log($number, $base) : self
749
    {
750 1
        $this->expr->log($number, $base);
751
752 1
        return $this;
753
    }
754
755
    /**
756
     * Calculates the log base 10 of a number and returns the result as a double.
757
     *
758
     * The <number> expression can be any valid expression as long as it
759
     * resolves to a non-negative number.
760
     * The <base> expression can be any valid expression as long as it resolves
761
     * to a positive number greater than 1.
762
     *
763
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/log/
764
     * @see Expr::log10
765
     *
766
     * @param mixed|Expr $number
767
     */
768 1
    public function log10($number) : self
769
    {
770 1
        $this->expr->log10($number);
771
772 1
        return $this;
773
    }
774
775
    /**
776
     * Compares two values and returns:
777
     * true when the first value is less than the second value.
778
     * false when the first value is greater than or equivalent to the second value.
779
     *
780
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/lt/
781
     * @see Expr::lt
782
     *
783
     * @param mixed|Expr $expression1
784
     * @param mixed|Expr $expression2
785
     */
786 1
    public function lt($expression1, $expression2) : self
787
    {
788 1
        $this->expr->lt($expression1, $expression2);
789
790 1
        return $this;
791
    }
792
793
    /**
794
     * Compares two values and returns:
795
     * true when the first value is less than or equivalent to the second value.
796
     * false when the first value is greater than the second value.
797
     *
798
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/lte/
799
     * @see Expr::lte
800
     *
801
     * @param mixed|Expr $expression1
802
     * @param mixed|Expr $expression2
803
     */
804 1
    public function lte($expression1, $expression2) : self
805
    {
806 1
        $this->expr->lte($expression1, $expression2);
807
808 1
        return $this;
809
    }
810
811
    /**
812
     * Applies an expression to each item in an array and returns an array with
813
     * the applied results.
814
     *
815
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/map/
816
     * @see Expr::map
817
     *
818
     * @param mixed|Expr $input An expression that resolves to an array.
819
     * @param string     $as    The variable name for the items in the input array. The in expression accesses each item in the input array by this variable.
820
     * @param mixed|Expr $in    The expression to apply to each item in the input array. The expression accesses the item by its variable name.
821
     */
822 1
    public function map($input, $as, $in) : self
823
    {
824 1
        $this->expr->map($input, $as, $in);
825
826 1
        return $this;
827
    }
828
829
    /**
830
     * Returns the metadata associated with a document in a pipeline operations.
831
     *
832
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/meta/
833
     * @see Expr::meta
834
     *
835
     * @param mixed|Expr $metaDataKeyword
836
     */
837 1
    public function meta($metaDataKeyword) : self
838
    {
839 1
        $this->expr->meta($metaDataKeyword);
840
841 1
        return $this;
842
    }
843
844
    /**
845
     * Returns the millisecond portion of a date as an integer between 0 and 999.
846
     *
847
     * The argument can be any expression as long as it resolves to a date.
848
     *
849
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/millisecond/
850
     * @see Expr::millisecond
851
     *
852
     * @param mixed|Expr $expression
853
     */
854 1
    public function millisecond($expression) : self
855
    {
856 1
        $this->expr->millisecond($expression);
857
858 1
        return $this;
859
    }
860
861
    /**
862
     * Returns the minute portion of a date as a number between 0 and 59.
863
     *
864
     * The argument can be any expression as long as it resolves to a date.
865
     *
866
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/minute/
867
     * @see Expr::minute
868
     *
869
     * @param mixed|Expr $expression
870
     */
871 1
    public function minute($expression) : self
872
    {
873 1
        $this->expr->minute($expression);
874
875 1
        return $this;
876
    }
877
878
    /**
879
     * Divides one number by another and returns the remainder. The first
880
     * argument is divided by the second argument.
881
     *
882
     * The arguments can be any valid expression as long as they resolve to numbers.
883
     *
884
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/mod/
885
     * @see Expr::mod
886
     *
887
     * @param mixed|Expr $expression1
888
     * @param mixed|Expr $expression2
889
     */
890 1
    public function mod($expression1, $expression2) : self
891
    {
892 1
        $this->expr->mod($expression1, $expression2);
893
894 1
        return $this;
895
    }
896
897
    /**
898
     * Returns the month of a date as a number between 1 and 12.
899
     *
900
     * The argument can be any expression as long as it resolves to a date.
901
     *
902
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/month/
903
     * @see Expr::month
904
     *
905
     * @param mixed|Expr $expression
906
     */
907 1
    public function month($expression) : self
908
    {
909 1
        $this->expr->month($expression);
910
911 1
        return $this;
912
    }
913
914
    /**
915
     * Multiplies numbers together and returns the result.
916
     *
917
     * The arguments can be any valid expression as long as they resolve to numbers.
918
     *
919
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/multiply/
920
     * @see Expr::multiply
921
     *
922
     * @param mixed|Expr $expression1
923
     * @param mixed|Expr $expression2
924
     * @param mixed|Expr ...$expressions Additional expressions
925
     */
926 5
    public function multiply($expression1, $expression2, ...$expressions) : self
0 ignored issues
show
Unused Code introduced by
The parameter $expression1 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...
Unused Code introduced by
The parameter $expression2 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...
Unused Code introduced by
The parameter $expressions 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...
927
    {
928 5
        $this->expr->multiply(...func_get_args());
929
930 5
        return $this;
931
    }
932
933
    /**
934
     * Compares two values and returns:
935
     * true when the values are not equivalent.
936
     * false when the values are equivalent.
937
     *
938
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/ne/
939
     * @see Expr::ne
940
     *
941
     * @param mixed|Expr $expression1
942
     * @param mixed|Expr $expression2
943
     */
944 1
    public function ne($expression1, $expression2) : self
945
    {
946 1
        $this->expr->ne($expression1, $expression2);
947
948 1
        return $this;
949
    }
950
951
    /**
952
     * Evaluates a boolean and returns the opposite boolean value.
953
     *
954
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/not/
955
     * @see Expr::not
956
     *
957
     * @param mixed|Expr $expression
958
     */
959 1
    public function not($expression) : self
960
    {
961 1
        $this->expr->not($expression);
962
963 1
        return $this;
964
    }
965
966
    /**
967
     * Raises a number to the specified exponent and returns the result.
968
     *
969
     * The <number> expression can be any valid expression as long as it
970
     * resolves to a non-negative number.
971
     * The <exponent> expression can be any valid expression as long as it
972
     * resolves to a number.
973
     *
974
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/pow/
975
     * @see Expr::pow
976
     *
977
     * @param mixed|Expr $number
978
     * @param mixed|Expr $exponent
979
     */
980 1
    public function pow($number, $exponent) : self
981
    {
982 1
        $this->expr->pow($number, $exponent);
983
984 1
        return $this;
985
    }
986
987
    /**
988
     * Returns an array whose elements are a generated sequence of numbers.
989
     *
990
     * $range generates the sequence from the specified starting number by successively incrementing the starting number by the specified step value up to but not including the end point.
991
     *
992
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/range/
993
     * @see Expr::range
994
     *
995
     * @param mixed|Expr $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer.
996
     * @param mixed|Expr $end   An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer.
997
     * @param mixed|Expr $step  Optional. An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1.
998
     */
999 2
    public function range($start, $end, $step = 1) : self
1000
    {
1001 2
        $this->expr->range($start, $end, $step);
1002
1003 2
        return $this;
1004
    }
1005
1006
    /**
1007
     * Applies an expression to each element in an array and combines them into
1008
     * a single value.
1009
     *
1010
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/reduce/
1011
     * @see Expr::reduce
1012
     *
1013
     * @param mixed|Expr $input        Can be any valid expression that resolves to an array.
1014
     * @param mixed|Expr $initialValue The initial cumulative value set before in is applied to the first element of the input array.
1015
     * @param mixed|Expr $in           A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left.
1016
     */
1017 1
    public function reduce($input, $initialValue, $in) : self
1018
    {
1019 1
        $this->expr->reduce($input, $initialValue, $in);
1020
1021 1
        return $this;
1022
    }
1023
1024
    /**
1025
     * Accepts an array expression as an argument and returns an array with the
1026
     * elements in reverse order.
1027
     *
1028
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/reverseArray/
1029
     * @see Expr::reverseArray
1030
     *
1031
     * @param mixed|Expr $expression
1032
     */
1033 1
    public function reverseArray($expression) : self
1034
    {
1035 1
        $this->expr->reverseArray($expression);
1036
1037 1
        return $this;
1038
    }
1039
1040
    /**
1041
     * Returns the second portion of a date as a number between 0 and 59, but
1042
     * can be 60 to account for leap seconds.
1043
     *
1044
     * The argument can be any expression as long as it resolves to a date.
1045
     *
1046
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/second/
1047
     * @see Expr::second
1048
     *
1049
     * @param mixed|Expr $expression
1050
     */
1051 1
    public function second($expression) : self
1052
    {
1053 1
        $this->expr->second($expression);
1054
1055 1
        return $this;
1056
    }
1057
1058
    /**
1059
     * Takes two sets and returns an array containing the elements that only
1060
     * exist in the first set.
1061
     *
1062
     * The arguments can be any valid expression as long as they each resolve to an array.
1063
     *
1064
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/setDifference/
1065
     * @see Expr::setDifference
1066
     *
1067
     * @param mixed|Expr $expression1
1068
     * @param mixed|Expr $expression2
1069
     */
1070 1
    public function setDifference($expression1, $expression2) : self
1071
    {
1072 1
        $this->expr->setDifference($expression1, $expression2);
1073
1074 1
        return $this;
1075
    }
1076
1077
    /**
1078
     * Compares two or more arrays and returns true if they have the same
1079
     * distinct elements and false otherwise.
1080
     *
1081
     * The arguments can be any valid expression as long as they each resolve to an array.
1082
     *
1083
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/setEquals/
1084
     * @see Expr::setEquals
1085
     *
1086
     * @param mixed|Expr $expression1
1087
     * @param mixed|Expr $expression2
1088
     * @param mixed|Expr ...$expressions Additional sets
1089
     *
1090
     * @return $this
1091
     */
1092 2
    public function setEquals($expression1, $expression2, ...$expressions) : self
0 ignored issues
show
Unused Code introduced by
The parameter $expression1 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...
Unused Code introduced by
The parameter $expression2 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...
Unused Code introduced by
The parameter $expressions 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...
1093
    {
1094 2
        $this->expr->setEquals(...func_get_args());
1095
1096 2
        return $this;
1097
    }
1098
1099
    /**
1100
     * Takes two or more arrays and returns an array that contains the elements
1101
     * that appear in every input array.
1102
     *
1103
     * The arguments can be any valid expression as long as they each resolve to an array.
1104
     *
1105
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/setIntersection/
1106
     * @see Expr::setIntersection
1107
     *
1108
     * @param mixed|Expr $expression1
1109
     * @param mixed|Expr $expression2
1110
     * @param mixed|Expr ...$expressions Additional sets
1111
     */
1112 2
    public function setIntersection($expression1, $expression2, ...$expressions) : self
0 ignored issues
show
Unused Code introduced by
The parameter $expression1 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...
Unused Code introduced by
The parameter $expression2 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...
Unused Code introduced by
The parameter $expressions 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...
1113
    {
1114 2
        $this->expr->setIntersection(...func_get_args());
1115
1116 2
        return $this;
1117
    }
1118
1119
    /**
1120
     * Takes two arrays and returns true when the first array is a subset of the
1121
     * second, including when the first array equals the second array, and false
1122
     * otherwise.
1123
     *
1124
     * The arguments can be any valid expression as long as they each resolve to an array.
1125
     *
1126
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/setIsSubset/
1127
     * @see Expr::setIsSubset
1128
     *
1129
     * @param mixed|Expr $expression1
1130
     * @param mixed|Expr $expression2
1131
     */
1132 1
    public function setIsSubset($expression1, $expression2) : self
1133
    {
1134 1
        $this->expr->setIsSubset($expression1, $expression2);
1135
1136 1
        return $this;
1137
    }
1138
1139
    /**
1140
     * Takes two or more arrays and returns an array containing the elements
1141
     * that appear in any input array.
1142
     *
1143
     * The arguments can be any valid expression as long as they each resolve to an array.
1144
     *
1145
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/setUnion/
1146
     * @see Expr::setUnion
1147
     *
1148
     * @param mixed|Expr $expression1
1149
     * @param mixed|Expr $expression2
1150
     * @param mixed|Expr ...$expressions Additional sets
1151
     */
1152 2
    public function setUnion($expression1, $expression2, ...$expressions) : self
0 ignored issues
show
Unused Code introduced by
The parameter $expression1 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...
Unused Code introduced by
The parameter $expression2 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...
Unused Code introduced by
The parameter $expressions 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...
1153
    {
1154 2
        $this->expr->setUnion(...func_get_args());
1155
1156 2
        return $this;
1157
    }
1158
1159
    /**
1160
     * Counts and returns the total the number of items in an array.
1161
     *
1162
     * The argument can be any expression as long as it resolves to an array.
1163
     *
1164
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/size/
1165
     * @see Expr::size
1166
     *
1167
     * @param mixed|Expr $expression
1168
     */
1169 1
    public function size($expression) : self
1170
    {
1171 1
        $this->expr->size($expression);
1172
1173 1
        return $this;
1174
    }
1175
1176
    /**
1177
     * Returns a subset of an array.
1178
     *
1179
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/slice/
1180
     * @see Expr::slice
1181
     *
1182
     * @param mixed|Expr      $array
1183
     * @param mixed|Expr      $n
1184
     * @param mixed|Expr|null $position
1185
     */
1186 2
    public function slice($array, $n, $position = null) : self
1187
    {
1188 2
        $this->expr->slice($array, $n, $position);
1189
1190 2
        return $this;
1191
    }
1192
1193
    /**
1194
     * Divides a string into an array of substrings based on a delimiter.
1195
     *
1196
     * $split removes the delimiter and returns the resulting substrings as
1197
     * elements of an array. If the delimiter is not found in the string, $split
1198
     * returns the original string as the only element of an array.
1199
     *
1200
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/split/
1201
     *
1202
     * @param mixed|Expr $string    The string to be split. Can be any valid expression as long as it resolves to a string.
1203
     * @param mixed|Expr $delimiter The delimiter to use when splitting the string expression. Can be any valid expression as long as it resolves to a string.
1204
     */
1205 1
    public function split($string, $delimiter) : self
1206
    {
1207 1
        $this->expr->split($string, $delimiter);
1208
1209 1
        return $this;
1210
    }
1211
1212
    /**
1213
     * Calculates the square root of a positive number and returns the result as
1214
     * a double.
1215
     *
1216
     * The argument can be any valid expression as long as it resolves to a
1217
     * non-negative number.
1218
     *
1219
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/sqrt/
1220
     * @see Expr::sqrt
1221
     *
1222
     * @param mixed|Expr $expression
1223
     */
1224 1
    public function sqrt($expression) : self
1225
    {
1226 1
        $this->expr->sqrt($expression);
1227
1228 1
        return $this;
1229
    }
1230
1231
    /**
1232
     * Performs case-insensitive comparison of two strings. Returns
1233
     * 1 if first string is “greater than” the second string.
1234
     * 0 if the two strings are equal.
1235
     * -1 if the first string is “less than” the second string.
1236
     *
1237
     * The arguments can be any valid expression as long as they resolve to strings.
1238
     *
1239
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/strcasecmp/
1240
     * @see Expr::strcasecmp
1241
     *
1242
     * @param mixed|Expr $expression1
1243
     * @param mixed|Expr $expression2
1244
     */
1245 1
    public function strcasecmp($expression1, $expression2) : self
1246
    {
1247 1
        $this->expr->strcasecmp($expression1, $expression2);
1248
1249 1
        return $this;
1250
    }
1251
1252
    /**
1253
     * Returns the number of UTF-8 encoded bytes in the specified string.
1254
     *
1255
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/strLenBytes/
1256
     *
1257
     * @param mixed|Expr $string
1258
     */
1259 1
    public function strLenBytes($string) : self
1260
    {
1261 1
        $this->expr->strLenBytes($string);
1262
1263 1
        return $this;
1264
    }
1265
1266
    /**
1267
     * Returns the number of UTF-8 code points in the specified string.
1268
     *
1269
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/strLenCP/
1270
     *
1271
     * @param mixed|Expr $string
1272
     */
1273 1
    public function strLenCP($string) : self
1274
    {
1275 1
        $this->expr->strLenCP($string);
1276
1277 1
        return $this;
1278
    }
1279
1280
    /**
1281
     * Returns a substring of a string, starting at a specified index position
1282
     * and including the specified number of characters. The index is zero-based.
1283
     *
1284
     * The arguments can be any valid expression as long as long as the first argument resolves to a string, and the second and third arguments resolve to integers.
1285
     *
1286
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/substr/
1287
     * @see Expr::substr
1288
     *
1289
     * @param mixed|Expr $string
1290
     * @param mixed|Expr $start
1291
     * @param mixed|Expr $length
1292
     */
1293 1
    public function substr($string, $start, $length) : self
1294
    {
1295 1
        $this->expr->substr($string, $start, $length);
1296
1297 1
        return $this;
1298
    }
1299
1300
    /**
1301
     * Returns the substring of a string.
1302
     *
1303
     * The substring starts with the character at the specified UTF-8 byte index
1304
     * (zero-based) in the string and continues for the number of bytes
1305
     * specified.
1306
     *
1307
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/substrBytes/
1308
     *
1309
     * @param mixed|Expr $string The string from which the substring will be extracted. Can be any valid expression as long as it resolves to a string.
1310
     * @param mixed|Expr $start  Indicates the starting point of the substring. Can be any valid expression as long as it resolves to a non-negative integer or number that can be represented as an integer.
1311
     * @param mixed|Expr $count  Can be any valid expression as long as it resolves to a non-negative integer or number that can be represented as an integer.
1312
     */
1313 1
    public function substrBytes($string, $start, $count) : self
1314
    {
1315 1
        $this->expr->substrBytes($string, $start, $count);
1316
1317 1
        return $this;
1318
    }
1319
1320
    /**
1321
     * Returns the substring of a string.
1322
     *
1323
     * The substring starts with the character at the specified UTF-8 code point
1324
     * (CP) index (zero-based) in the string for the number of code points
1325
     * specified.
1326
     *
1327
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/substrBytes/
1328
     *
1329
     * @param mixed|Expr $string The string from which the substring will be extracted. Can be any valid expression as long as it resolves to a string.
1330
     * @param mixed|Expr $start  Indicates the starting point of the substring. Can be any valid expression as long as it resolves to a non-negative integer or number that can be represented as an integer.
1331
     * @param mixed|Expr $count  Can be any valid expression as long as it resolves to a non-negative integer or number that can be represented as an integer.
1332
     */
1333 1
    public function substrCP($string, $start, $count) : self
1334
    {
1335 1
        $this->expr->substrCP($string, $start, $count);
1336
1337 1
        return $this;
1338
    }
1339
1340
    /**
1341
     * Subtracts two numbers to return the difference. The second argument is
1342
     * subtracted from the first argument.
1343
     *
1344
     * The arguments can be any valid expression as long as they resolve to numbers and/or dates.
1345
     *
1346
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/subtract/
1347
     * @see Expr::subtract
1348
     *
1349
     * @param mixed|Expr $expression1
1350
     * @param mixed|Expr $expression2
1351
     */
1352 1
    public function subtract($expression1, $expression2) : self
1353
    {
1354 1
        $this->expr->subtract($expression1, $expression2);
1355
1356 1
        return $this;
1357
    }
1358
1359
    /**
1360
     * Converts a string to lowercase, returning the result.
1361
     *
1362
     * The argument can be any expression as long as it resolves to a string.
1363
     *
1364
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/toLower/
1365
     * @see Expr::toLower
1366
     *
1367
     * @param mixed|Expr $expression
1368
     */
1369 1
    public function toLower($expression) : self
1370
    {
1371 1
        $this->expr->toLower($expression);
1372
1373 1
        return $this;
1374
    }
1375
1376
    /**
1377
     * Converts a string to uppercase, returning the result.
1378
     *
1379
     * The argument can be any expression as long as it resolves to a string.
1380
     *
1381
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/toUpper/
1382
     * @see Expr::toUpper
1383
     *
1384
     * @param mixed|Expr $expression
1385
     */
1386 1
    public function toUpper($expression) : self
1387
    {
1388 1
        $this->expr->toUpper($expression);
1389
1390 1
        return $this;
1391
    }
1392
1393
    /**
1394
     * Truncates a number to its integer.
1395
     *
1396
     * The <number> expression can be any valid expression as long as it
1397
     * resolves to a number.
1398
     *
1399
     * @see https://docs.mongodb.org/manual/reference/operator/aggregation/trunc/
1400
     * @see Expr::trunc
1401
     *
1402
     * @param mixed|Expr $number
1403
     */
1404 1
    public function trunc($number) : self
1405
    {
1406 1
        $this->expr->trunc($number);
1407
1408 1
        return $this;
1409
    }
1410
1411
    /**
1412
     * Returns a string that specifies the BSON type of the argument.
1413
     *
1414
     * The argument can be any valid expression.
1415
     *
1416
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/type/
1417
     *
1418
     * @param mixed|Expr $expression
1419
     */
1420 1
    public function type($expression) : self
1421
    {
1422 1
        $this->expr->type($expression);
1423
1424 1
        return $this;
1425
    }
1426
1427
    /**
1428
     * Returns the week of the year for a date as a number between 0 and 53.
1429
     *
1430
     * The argument can be any expression as long as it resolves to a date.
1431
     *
1432
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/week/
1433
     * @see Expr::week
1434
     *
1435
     * @param mixed|Expr $expression
1436
     */
1437 1
    public function week($expression) : self
1438
    {
1439 1
        $this->expr->week($expression);
1440
1441 1
        return $this;
1442
    }
1443
1444
    /**
1445
     * Returns the year portion of a date.
1446
     *
1447
     * The argument can be any expression as long as it resolves to a date.
1448
     *
1449
     * @see http://docs.mongodb.org/manual/reference/operator/aggregation/year/
1450
     * @see Expr::year
1451
     *
1452
     * @param mixed|Expr $expression
1453
     */
1454 2
    public function year($expression) : self
1455
    {
1456 2
        $this->expr->year($expression);
1457
1458 2
        return $this;
1459
    }
1460
1461
    /**
1462
     * Transposes an array of input arrays so that the first element of the
1463
     * output array would be an array containing, the first element of the first
1464
     * input array, the first element of the second input array, etc.
1465
     *
1466
     * @see https://docs.mongodb.com/manual/reference/operator/aggregation/zip/
1467
     * @see Expr::zip
1468
     *
1469
     * @param mixed|Expr      $inputs           An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array.
1470
     * @param bool|null       $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array.
1471
     * @param mixed|Expr|null $defaults         An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error.
1472
     */
1473 3
    public function zip($inputs, ?bool $useLongestLength = null, $defaults = null) : self
1474
    {
1475 3
        $this->expr->zip($inputs, $useLongestLength, $defaults);
1476
1477 3
        return $this;
1478
    }
1479
}
1480