Code Duplication    Length = 14-14 lines in 2 locations

src/Http/Controllers/ImageBrowserController.php 1 location

@@ 57-70 (lines=14) @@
54
     * @param array $mediaFiles
55
     * @return array
56
     */
57
    public function getMediaFiles($currentPath = null, $mediaFiles = [])
58
    {
59
        $path = storage_path('app/public/media' . $currentPath);
60
        foreach (Finder::create()->in($path)->sortByType()->depth(0) as $file) {
61
            $mediaFiles[] = [
62
                'filename' => $file->getFilename(),
63
                'realPath' => $file->getRealPath(),
64
                'type'     => $file->getType(),
65
                'filepath' => str_replace(storage_path('app/public/media'), '', $file->getRealPath()),
66
            ];
67
        }
68
69
        return $mediaFiles;
70
    }
71
}
72

src/Http/Traits/BrowsableTrait.php 1 location

@@ 45-58 (lines=14) @@
42
     * @param array $mediaFiles
43
     * @return array
44
     */
45
    public function getMediaFiles($currentPath = null, $mediaFiles = [])
46
    {
47
        $path = storage_path('app/public/media' . $currentPath);
48
        foreach (Finder::create()->in($path)->sortByType()->depth(0) as $file) {
49
            $mediaFiles[] = [
50
                'filename' => $file->getFilename(),
51
                'realPath' => $file->getRealPath(),
52
                'type'     => $file->getType(),
53
                'filepath' => str_replace(storage_path('app/public/media'), '', $file->getRealPath()),
54
            ];
55
        }
56
57
        return $mediaFiles;
58
    }
59
60
    /**
61
     * Symfony file finder.