Code Duplication    Length = 14-14 lines in 2 locations

Imagine/Filter/FilterManager.php 2 locations

@@ 218-231 (lines=14) @@
215
     *
216
     * @return array
217
     */
218
    private function sanitizeFilters(array $filters): array
219
    {
220
        $sanitized = array_filter($filters, function (string $name): bool {
221
            return isset($this->loaders[$name]);
222
        }, ARRAY_FILTER_USE_KEY);
223
224
        if (count($filters) !== count($sanitized)) {
225
            throw new \InvalidArgumentException(sprintf('Could not find filter(s): %s', implode(', ', array_map(function (string $name): string {
226
                return sprintf('"%s"', $name);
227
            }, array_diff(array_keys($filters), array_keys($sanitized))))));
228
        }
229
230
        return $sanitized;
231
    }
232
233
    /**
234
     * @param array $processors
@@ 238-251 (lines=14) @@
235
     *
236
     * @return array
237
     */
238
    private function sanitizePostProcessors(array $processors): array
239
    {
240
        $sanitized = array_filter($processors, function (string $name): bool {
241
            return isset($this->postProcessors[$name]);
242
        }, ARRAY_FILTER_USE_KEY);
243
244
        if (count($processors) !== count($sanitized)) {
245
            throw new \InvalidArgumentException(sprintf('Could not find post processor(s): %s', implode(', ', array_map(function (string $name): string {
246
                return sprintf('"%s"', $name);
247
            }, array_diff(array_keys($processors), array_keys($sanitized))))));
248
        }
249
250
        return $sanitized;
251
    }
252
253
    /**
254
     * We are done with the image object so we can destruct the this because imagick keeps consuming memory if we don't.