Code Duplication    Length = 13-13 lines in 3 locations

lib/Doctrine/ODM/MongoDB/Aggregation/Expr.php 3 locations

@@ 649-661 (lines=13) @@
646
     * @param mixed|self $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.
647
     * @return $this
648
     */
649
    public function indexOfArray($arrayExpression, $searchExpression, $start = null, $end = null)
650
    {
651
        $args = [$arrayExpression, $searchExpression];
652
        if ($start !== null) {
653
            $args[] = $start;
654
655
            if ($end !== null) {
656
                $args[] = $end;
657
            }
658
        }
659
660
        return $this->operator('$indexOfArray', $args);
661
    }
662
663
    /**
664
     * Searches a string for an occurrence of a substring and returns the UTF-8
@@ 676-688 (lines=13) @@
673
     *
674
     * @return $this
675
     */
676
    public function indexOfBytes($stringExpression, $substringExpression, $start = null, $end = null)
677
    {
678
        $args = [$stringExpression, $substringExpression];
679
        if ($start !== null) {
680
            $args[] = $start;
681
682
            if ($end !== null) {
683
                $args[] = $end;
684
            }
685
        }
686
687
        return $this->operator('$indexOfBytes', $args);
688
    }
689
690
    /**
691
     * Searches a string for an occurrence of a substring and returns the UTF-8
@@ 703-715 (lines=13) @@
700
     *
701
     * @return $this
702
     */
703
    public function indexOfCP($stringExpression, $substringExpression, $start = null, $end = null)
704
    {
705
        $args = [$stringExpression, $substringExpression];
706
        if ($start !== null) {
707
            $args[] = $start;
708
709
            if ($end !== null) {
710
                $args[] = $end;
711
            }
712
        }
713
714
        return $this->operator('$indexOfCP', $args);
715
    }
716
717
    /**
718
     * Determines if the operand is an array. Returns a boolean.