Complex classes like Operator often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Operator, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
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) |
|
34 | |||
35 | 5 | public function __call(string $method, array $args) : self |
|
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 |
|
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 |
|
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 |
||
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 |
||
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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) |
|
407 | |||
408 | /** |
||
409 | * Set the current field for building the expression. |
||
410 | * |
||
411 | * @see Expr::field |
||
412 | */ |
||
413 | 28 | public function field(string $fieldName) |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
1479 | } |
||
1480 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.