Code Duplication    Length = 14-14 lines in 4 locations

src/Set.php 4 locations

@@ 161-174 (lines=14) @@
158
     *
159
     * @return Set
160
     */
161
    final public function union(Set $set)
162
    {
163
        $bit = $this->bit;
164
        foreach (func_get_args() as $set) {
165
            self::validateType($set);
166
167
            $bit |= $set->bit;
168
        }
169
170
        $clone = new static();
171
        $clone->bit = $bit;
172
173
        return $clone;
174
    }
175
176
    /**
177
     * Produce a new set with enum common to both this and other (this & other).
@@ 183-196 (lines=14) @@
180
     *
181
     * @return Set
182
     */
183
    final public function intersect(Set $set)
184
    {
185
        $bit = $this->bit;
186
        foreach (func_get_args() as $set) {
187
            self::validateType($set);
188
189
            $bit &= $set->bit;
190
        }
191
192
        $clone = new static();
193
        $clone->bit = $bit;
194
195
        return $clone;
196
    }
197
198
    /**
199
     * Produce a new set with enum in this but not in other (this - other).
@@ 205-218 (lines=14) @@
202
     *
203
     * @return Set
204
     */
205
    final public function diff(Set $set)
206
    {
207
        $bit = 0;
208
        foreach (func_get_args() as $set) {
209
            self::validateType($set);
210
211
            $bit |= $set->bit;
212
        }
213
214
        $clone = new static();
215
        $clone->bit = $this->bit & ~$bit;
216
217
        return $clone;
218
    }
219
220
    /**
221
     * Produce a new set with enum in either this and other but not in both (this ^ (other | other)).
@@ 227-240 (lines=14) @@
224
     *
225
     * @return Set
226
     */
227
    final public function symDiff(Set $set)
228
    {
229
        $bit = 0;
230
        foreach (func_get_args() as $set) {
231
            self::validateType($set);
232
233
            $bit |= $set->bit;
234
        }
235
236
        $clone = new static();
237
        $clone->bit = $this->bit ^ $bit;
238
239
        return $clone;
240
    }
241
242
    /**
243
     * Get choices for checkbox group.