Code Duplication    Length = 13-18 lines in 3 locations

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

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