Code Duplication    Length = 11-11 lines in 2 locations

src/Collection.php 2 locations

@@ 164-174 (lines=11) @@
161
     * {@inheritdoc}
162
     *
163
     */
164
    public function diff(CollectionInterface ...$collection)
165
    {
166
        $diffs = array_map(function($item) {
167
            return $item->toArray();
168
        }, $collection);
169
170
        $func = ($this instanceof KeyedCollection) ? 'array_diff_assoc' : 'array_diff';
171
        $data = $func($this->data, ...$diffs);
172
173
        return new static($data);
174
    }
175
176
177
    /**
@@ 181-191 (lines=11) @@
178
     * {@inheritdoc}
179
     *
180
     */
181
    public function intersect(CollectionInterface ...$collection)
182
    {
183
        $intersections = array_map(function($item) {
184
            return $item->toArray();
185
        }, $collection);
186
187
        $func = ($this instanceof KeyedCollection) ? 'array_intersect_assoc' : 'array_intersect';
188
        $data = $func($this->data, ...$intersections);
189
190
        return new static($data);
191
    }
192
}
193