DownloadController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDownload() 0 9 2
1
<?php
2
3
namespace UniSharp\LaravelFilemanager\Controllers;
4
5
use Illuminate\Support\Facades\Storage;
6
7
class DownloadController extends LfmController
8
{
9
    public function getDownload()
10
    {
11
        $file = $this->lfm->setName(request('file'));
0 ignored issues
show
Bug introduced by
The function request was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
        $file = $this->lfm->setName(/** @scrutinizer ignore-call */ request('file'));
Loading history...
Bug Best Practice introduced by
The property lfm does not exist on UniSharp\LaravelFilemana...lers\DownloadController. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
The method setName() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
        /** @scrutinizer ignore-call */ 
12
        $file = $this->lfm->setName(request('file'));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
12
13
        if (!Storage::disk($this->helper->config('disk'))->exists($file->path('storage'))) {
0 ignored issues
show
Bug Best Practice introduced by
The property helper does not exist on UniSharp\LaravelFilemana...lers\DownloadController. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
The method config() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
        if (!Storage::disk($this->helper->/** @scrutinizer ignore-call */ config('disk'))->exists($file->path('storage'))) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
14
            abort(404);
0 ignored issues
show
Bug introduced by
The function abort was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
            /** @scrutinizer ignore-call */ 
15
            abort(404);
Loading history...
15
        }
16
17
        return Storage::disk($this->helper->config('disk'))->download($file->path('storage'));
18
    }
19
}
20