Test Failed
Push — master ( d4bdb3...458817 )
by Marcel
01:05
created

SubmitController::logo_add()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 24
rs 8.9713
cc 1
eloc 15
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Events\Obyx;
6
use App\Models\Logo;
7
use Illuminate\Http\Request;
8
use Illuminate\Http\UploadedFile;
9
use Illuminate\Support\Facades\File;
10
11
class SubmitController extends Controller
12
{
13
    public function index()
14
    {
15
        //Zeige Submit View
16
        return view('submit.index');
17
    }
18
19
    public function logo_index()
20
    {
21
        //Zeige View zum Einsenden eines Logos
22
        return view('submit.logo.index');
23
    }
24
25
    public function logo_add(Request $request)
26
    {
27
        $this->validate($request, [
28
            'file'     => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
29
            'logoname' => 'required',
30
        ]);
31
32
        $file = $request->file('file');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
33
        $extorig = $file->getExtension();
34
35
        $imageName = \Storage::putFile('logos', new UploadedFile($file->path(), $file->getClientOriginalName()));
36
        //dd($file);
37
38
        $l = new Logo();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 12 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
39
        $l->extension = \Storage::mimeType($imageName);
40
        $l->filename = str_replace($extorig, '', $imageName);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
41
        $l->title = $request->get('logoname');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
42
        $l->user_id = \Auth::id();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
43
        $l->save();
44
45
        event(new Obyx('logo-add', \Auth::id()));
46
47
        return redirect()->route('submit.logo.success');
48
    }
49
}
50