Code Duplication    Length = 13-13 lines in 3 locations

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

@@ 656-668 (lines=13) @@
653
     * @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.
654
     * @return $this
655
     */
656
    public function indexOfArray($arrayExpression, $searchExpression, $start = null, $end = null)
657
    {
658
        $args = [$arrayExpression, $searchExpression];
659
        if ($start !== null) {
660
            $args[] = $start;
661
662
            if ($end !== null) {
663
                $args[] = $end;
664
            }
665
        }
666
667
        return $this->operator('$indexOfArray', $args);
668
    }
669
670
    /**
671
     * Searches a string for an occurence of a substring and returns the UTF-8
@@ 684-696 (lines=13) @@
681
     *
682
     * @return $this
683
     */
684
    public function indexOfBytes($stringExpression, $substringExpression, $start = null, $end = null)
685
    {
686
        $args = [$stringExpression, $substringExpression];
687
        if ($start !== null) {
688
            $args[] = $start;
689
690
            if ($end !== null) {
691
                $args[] = $end;
692
            }
693
        }
694
695
        return $this->operator('$indexOfBytes', $args);
696
    }
697
698
    /**
699
     * Searches a string for an occurence of a substring and returns the UTF-8
@@ 712-724 (lines=13) @@
709
     *
710
     * @return $this
711
     */
712
    public function indexOfCP($stringExpression, $substringExpression, $start = null, $end = null)
713
    {
714
        $args = [$stringExpression, $substringExpression];
715
        if ($start !== null) {
716
            $args[] = $start;
717
718
            if ($end !== null) {
719
                $args[] = $end;
720
            }
721
        }
722
723
        return $this->operator('$indexOfCP', $args);
724
    }
725
726
    /**
727
     * Determines if the operand is an array. Returns a boolean.