Code Duplication    Length = 13-18 lines in 3 locations

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

@@ 72-89 (lines=18) @@
69
     * @param array|Expr $expression
70
     * @return $this
71
     */
72
    public function addAnd($expression /*, $expression2, ... */)
73
    {
74
        if (! isset($this->query['$and'])) {
75
            $this->query['$and'] = [];
76
        }
77
78
        $this->query['$and'] = array_merge(
79
            $this->query['$and'],
80
            array_map(
81
                function ($expression) {
82
                    return $expression instanceof Expr ? $expression->getQuery() : $expression;
83
                },
84
                func_get_args()
85
            )
86
        );
87
88
        return $this;
89
    }
90
91
    /**
92
     * Add one or more $nor clauses to the current query.
@@ 99-111 (lines=13) @@
96
     * @param array|Expr $expression
97
     * @return $this
98
     */
99
    public function addNor($expression /* , $expression2, ... */)
100
    {
101
        if (! isset($this->query['$nor'])) {
102
            $this->query['$nor'] = [];
103
        }
104
105
        $this->query['$nor'] = array_merge(
106
            $this->query['$nor'],
107
            array_map(function ($expression) { return $expression instanceof Expr ? $expression->getQuery() : $expression; }, func_get_args())
108
        );
109
110
        return $this;
111
    }
112
113
    /**
114
     * Add one or more $or clauses to the current query.
@@ 121-133 (lines=13) @@
118
     * @param array|Expr $expression
119
     * @return $this
120
     */
121
    public function addOr($expression /* , $expression2, ... */)
122
    {
123
        if (! isset($this->query['$or'])) {
124
            $this->query['$or'] = [];
125
        }
126
127
        $this->query['$or'] = array_merge(
128
            $this->query['$or'],
129
            array_map(function ($expression) { return $expression instanceof Expr ? $expression->getQuery() : $expression; }, func_get_args())
130
        );
131
132
        return $this;
133
    }
134
135
    /**
136
     * Append one or more values to the current array field only if they do not