MediaGridController::ckIndex()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
dl 7
loc 7
rs 9.4286
c 2
b 0
f 1
cc 1
eloc 4
nc 1
nop 0
1
<?php namespace Modules\Media\Http\Controllers\Admin;
2
3
use Modules\Core\Http\Controllers\Admin\AdminBaseController;
4
use Modules\Media\Image\ThumbnailsManager;
5
use Modules\Media\Repositories\FileRepository;
6
7
class MediaGridController extends AdminBaseController
8
{
9
    /**
10
     * @var FileRepository
11
     */
12
    private $file;
13
    /**
14
     * @var ThumbnailsManager
15
     */
16
    private $thumbnailsManager;
17
18
    public function __construct(FileRepository $file, ThumbnailsManager $thumbnailsManager)
19
    {
20
        parent::__construct();
21
22
        $this->file = $file;
23
        $this->thumbnailsManager = $thumbnailsManager;
24
    }
25
26
    /**
27
     * A grid view for the upload button
28
     * @return \Illuminate\View\View
29
     */
30 View Code Duplication
    public function index()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $files = $this->file->all();
33
        $thumbnails = $this->thumbnailsManager->all();
34
35
        return view('media::admin.grid.general', compact('files', 'thumbnails'));
0 ignored issues
show
Bug Compatibility introduced by
The expression view('media::admin.grid....files', 'thumbnails')); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 35 which is incompatible with the return type documented by Modules\Media\Http\Contr...iaGridController::index of type Illuminate\View\View.
Loading history...
36
    }
37
38
    /**
39
     * A grid view of uploaded files used for the wysiwyg editor
40
     * @return \Illuminate\View\View
41
     */
42 View Code Duplication
    public function ckIndex()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        $files = $this->file->all();
45
        $thumbnails = $this->thumbnailsManager->all();
46
47
        return view('media::admin.grid.ckeditor', compact('files', 'thumbnails'));
0 ignored issues
show
Bug Compatibility introduced by
The expression view('media::admin.grid....files', 'thumbnails')); of type Illuminate\View\View|Ill...\Contracts\View\Factory adds the type Illuminate\Contracts\View\Factory to the return on line 47 which is incompatible with the return type documented by Modules\Media\Http\Contr...GridController::ckIndex of type Illuminate\View\View.
Loading history...
48
    }
49
}
50