GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( f52031...bb06d5 )
by Toby
38:47 queued 25:32
created

DownloadFileController::download()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 4
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 2
rs 10
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\UploadFile\Http\Controllers\Participant;
4
5
use BristolSU\Module\UploadFile\Http\Controllers\Controller;
6
use BristolSU\Module\UploadFile\Models\File;
7
use BristolSU\Support\Activity\Activity;
8
use BristolSU\Support\ModuleInstance\ModuleInstance;
9
use Illuminate\Http\Request;
10
use Illuminate\Support\Facades\Storage;
11
use Symfony\Component\HttpKernel\Exception\HttpException;
12
13
class DownloadFileController extends Controller
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class DownloadFileController
Loading history...
14
{
15
16 3
    public function download(Request $request, Activity $activity, ModuleInstance $moduleInstance, File $file)
0 ignored issues
show
Unused Code introduced by
The parameter $moduleInstance is not used and could be removed. ( Ignorable by Annotation )

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

16
    public function download(Request $request, Activity $activity, /** @scrutinizer ignore-unused */ ModuleInstance $moduleInstance, File $file)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $activity is not used and could be removed. ( Ignorable by Annotation )

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

16
    public function download(Request $request, /** @scrutinizer ignore-unused */ Activity $activity, ModuleInstance $moduleInstance, File $file)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

16
    public function download(/** @scrutinizer ignore-unused */ Request $request, Activity $activity, ModuleInstance $moduleInstance, File $file)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
Missing doc comment for function download()
Loading history...
17
    {
18 3
        $this->authorize('file.download');
19
        
20 2
        if(Storage::exists($file->path)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
21 1
            return Storage::download($file->path, $file->filename, [
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
22 1
                'X-Vapor-Base64-Encode' => 'True'
23
            ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
24
        }
25
        
26 1
        throw new HttpException(404, 'File not found');
27
    }
28
29 3
    public function downloadOld(Request $request, Activity $activity, ModuleInstance $moduleInstance, File $file)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

29
    public function downloadOld(/** @scrutinizer ignore-unused */ Request $request, Activity $activity, ModuleInstance $moduleInstance, File $file)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $moduleInstance is not used and could be removed. ( Ignorable by Annotation )

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

29
    public function downloadOld(Request $request, Activity $activity, /** @scrutinizer ignore-unused */ ModuleInstance $moduleInstance, File $file)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $activity is not used and could be removed. ( Ignorable by Annotation )

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

29
    public function downloadOld(Request $request, /** @scrutinizer ignore-unused */ Activity $activity, ModuleInstance $moduleInstance, File $file)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
Missing doc comment for function downloadOld()
Loading history...
30
    {
31 3
        $this->authorize('file.download');
32
33 2
        if(Storage::exists($file->path)) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
34 1
            return Storage::download($file->path, $file->filename, [
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
35 1
                'X-Vapor-Base64-Encode' => 'True'
36
            ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
37
        }
38
39 1
        throw new HttpException(404, 'File not found');
40
    }
41
    
42
}