Code Duplication    Length = 7-7 lines in 3 locations

src/Grid/Displayers/Carousel.php 1 location

@@ 24-30 (lines=7) @@
21
        }
22
23
        $images = collect((array) $this->value)->filter()->map(function ($path) use ($server) {
24
            if (url()->isValidUrl($path) || strpos($path, 'data:image') === 0) {
25
                $image = $path;
26
            } elseif ($server) {
27
                $image = rtrim($server, '/').'/'.ltrim($path, '/');
28
            } else {
29
                $image = Storage::disk(config('admin.upload.disk'))->url($path);
30
            }
31
32
            $caption = '';
33

src/Grid/Displayers/Image.php 1 location

@@ 17-23 (lines=7) @@
14
        }
15
16
        return collect((array) $this->value)->filter()->map(function ($path) use ($server, $width, $height) {
17
            if (url()->isValidUrl($path) || strpos($path, 'data:image') === 0) {
18
                $src = $path;
19
            } elseif ($server) {
20
                $src = rtrim($server, '/').'/'.ltrim($path, '/');
21
            } else {
22
                $src = Storage::disk(config('admin.upload.disk'))->url($path);
23
            }
24
25
            return "<img src='$src' style='max-width:{$width}px;max-height:{$height}px' class='img img-thumbnail' />";
26
        })->implode('&nbsp;');

src/Grid/Displayers/Download.php 1 location

@@ 22-28 (lines=7) @@
19
                return '';
20
            }
21
22
            if (url()->isValidUrl($value)) {
23
                $src = $value;
24
            } elseif ($server) {
25
                $src = rtrim($server, '/').'/'.ltrim($value, '/');
26
            } else {
27
                $src = Storage::disk(config('admin.upload.disk'))->url($value);
28
            }
29
30
            $name = basename($value);
31