Code Duplication    Length = 18-18 lines in 2 locations

src/FileRepository.php 1 location

@@ 288-305 (lines=18) @@
285
     *
286
     * @return array
287
     */
288
    public function getOrdered($direction = 'asc') : array
289
    {
290
        $modules = $this->allEnabled();
291
292
        uasort($modules, function (Module $a, Module $b) use ($direction) {
293
            if ($a->get('priority') === $b->get('priority')) {
294
                return 0;
295
            }
296
297
            if ($direction === 'desc') {
298
                return $a->get('priority') < $b->get('priority') ? 1 : -1;
299
            }
300
301
            return $a->get('priority') > $b->get('priority') ? 1 : -1;
302
        });
303
304
        return $modules;
305
    }
306
307
    /**
308
     * @inheritDoc

src/Laravel/LaravelDatabaseRepository.php 1 location

@@ 275-292 (lines=18) @@
272
        }, ARRAY_FILTER_USE_KEY);
273
    }
274
275
    public function getOrdered($direction = 'asc'): array
276
    {
277
        $modules = $this->allEnabled();
278
279
        uasort($modules, function (DatabaseModule $a, DatabaseModule $b) use ($direction) {
280
            if ($a->get('priority') === $b->get('priority')) {
281
                return 0;
282
            }
283
284
            if ($direction === 'desc') {
285
                return $a->get('priority') < $b->get('priority') ? 1 : -1;
286
            }
287
288
            return $a->get('priority') > $b->get('priority') ? 1 : -1;
289
        });
290
291
        return $modules;
292
    }
293
}
294