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 ( 94138f...ec7d81 )
by Toby
22:20
created

FileController::store()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 14
nc 2
nop 2
dl 0
loc 23
ccs 15
cts 15
cp 1
crap 2
rs 9.7998
c 0
b 0
f 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\Module\UploadFile\Http\Controllers\AdminApi;
4
5
use BristolSU\Module\UploadFile\Events\DocumentUploaded;
6
use BristolSU\Module\UploadFile\Http\Controllers\Controller;
7
use BristolSU\Module\UploadFile\Http\Requests\AdminApi\FileController\StoreRequest;
8
use BristolSU\Module\UploadFile\Models\File;
9
use BristolSU\Support\Activity\Activity;
10
use BristolSU\Support\Authentication\Contracts\Authentication;
11
use BristolSU\Support\ModuleInstance\ModuleInstance;
12
use Illuminate\Http\Request;
13
use Illuminate\Support\Arr;
14
15
class FileController extends Controller
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class FileController
Loading history...
16
{
17
18 3
    public function index()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function index()
Loading history...
19
    {
20 3
        $this->authorize('admin.file.index');
21
        
22 2
        return File::forModuleInstance()->with(['statuses', 'comments'])->get();
23
    }
24
25 3
    public function show(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

25
    public function show(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

25
    public function show(/** @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 show()
Loading history...
26
    {
27 3
        $this->authorize('admin.file.index');
28
        
29 2
        return $file->load(['statuses', 'comments']);
30
    }
31
32 6
    public function store(StoreRequest $request, Authentication $authentication)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function store()
Loading history...
33
    {
34 6
        $fileMetadata = collect();
35
36 6
        foreach (Arr::wrap($request->file('file')) as $file) {
37
38 6
            $path = $file->store('uploadfile');
39
40 6
            $fileMetadata->push($tempFileMeta = File::create([
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...
41 6
                'title' => $request->input('title'),
42 6
                'description' => $request->input('description'),
43 6
                'filename' => $file->getClientOriginalName(),
44 6
                'mime' => $file->getClientMimeType(),
45 6
                'path' => $path,
46 6
                'size' => $file->getSize(),
47 6
                'uploaded_by' => $authentication->getUser()->id(),
48 6
                'activity_instance_id' => $request->input('activity_instance_id')
49
            ]));
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...
50
51 6
            event(new DocumentUploaded($tempFileMeta));
52
        }
53
54 6
        return $fileMetadata;
55
    }
56
    
57
}