Code Duplication    Length = 14-14 lines in 2 locations

src/EntityCollection.php 2 locations

@@ 209-222 (lines=14) @@
206
     * @param  \ArrayAccess|array $items
207
     * @return self
208
     */
209
    public function diff($items)
210
    {
211
        $diff = new static;
212
213
        $dictionary = $this->getDictionary($items);
214
215
        foreach ($this->items as $item) {
216
            if (!isset($dictionary[$this->getEntityKey($item)])) {
217
                $diff->add($item);
218
            }
219
        }
220
221
        return $diff;
222
    }
223
224
    /**
225
     * Intersect the collection with the given items.
@@ 231-244 (lines=14) @@
228
     * @throws MappingException
229
     * @return self
230
     */
231
    public function intersect($items)
232
    {
233
        $intersect = new static;
234
235
        $dictionary = $this->getDictionary($items);
236
237
        foreach ($this->items as $item) {
238
            if (isset($dictionary[$this->getEntityKey($item)])) {
239
                $intersect->add($item);
240
            }
241
        }
242
243
        return $intersect;
244
    }
245
246
    /**
247
     * Returns only the models from the collection with the specified keys.