Code Duplication    Length = 14-14 lines in 2 locations

src/Collection.php 2 locations

@@ 161-174 (lines=14) @@
158
     * @param  \ArrayAccess|array  $items
159
     * @return static
160
     */
161
    public function diff($items)
162
    {
163
        $diff = new static;
164
165
        $dictionary = $this->getDictionary($items);
166
167
        foreach ($this->items as $item) {
168
            if (!isset($dictionary[(string) $item->getKey()])) {
169
                $diff->add($item);
170
            }
171
        }
172
173
        return $diff;
174
    }
175
176
    /**
177
     * Intersect the collection with the given items.
@@ 182-195 (lines=14) @@
179
     * @param  \ArrayAccess|array  $items
180
     * @return static
181
     */
182
    public function intersect($items)
183
    {
184
        $intersect = new static;
185
186
        $dictionary = $this->getDictionary($items);
187
188
        foreach ($this->items as $item) {
189
            if (isset($dictionary[(string) $item->getKey()])) {
190
                $intersect->add($item);
191
            }
192
        }
193
194
        return $intersect;
195
    }
196
197
    /**
198
     * Get a dictionary keyed by primary keys.