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 ...$expressions
70
     * @return $this
71
     */
72
    public function addAnd($expression, ...$expressions)
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.
@@ 100-112 (lines=13) @@
97
     * @param array|Expr ...$expressions
98
     * @return $this
99
     */
100
    public function addNor($expression, ...$expressions)
101
    {
102
        if (! isset($this->query['$nor'])) {
103
            $this->query['$nor'] = [];
104
        }
105
106
        $this->query['$nor'] = array_merge(
107
            $this->query['$nor'],
108
            array_map(function ($expression) { return $expression instanceof Expr ? $expression->getQuery() : $expression; }, func_get_args())
109
        );
110
111
        return $this;
112
    }
113
114
    /**
115
     * Add one or more $or clauses to the current query.
@@ 123-135 (lines=13) @@
120
     * @param array|Expr ...$expressions
121
     * @return $this
122
     */
123
    public function addOr($expression, ...$expressions)
124
    {
125
        if (! isset($this->query['$or'])) {
126
            $this->query['$or'] = [];
127
        }
128
129
        $this->query['$or'] = array_merge(
130
            $this->query['$or'],
131
            array_map(function ($expression) { return $expression instanceof Expr ? $expression->getQuery() : $expression; }, func_get_args())
132
        );
133
134
        return $this;
135
    }
136
137
    /**
138
     * Append one or more values to the current array field only if they do not