SoftwareController   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 90
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 3 1
A create() 0 3 1
A store() 0 5 1
A __construct() 0 4 1
A edit() 0 3 1
A show() 0 3 1
A update() 0 5 1
A destroy() 0 5 1
1
<?php
2
3
namespace Adminetic\Website\Http\Controllers\Admin;
4
5
use Adminetic\Website\Contracts\SoftwareRepositoryInterface;
6
use Adminetic\Website\Http\Requests\SoftwareRequest;
7
use Adminetic\Website\Models\Admin\Software;
8
use App\Http\Controllers\Controller;
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Controller was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class SoftwareController extends Controller
11
{
12
    protected $softwareRepositoryInterface;
13
14
    public function __construct(SoftwareRepositoryInterface $softwareRepositoryInterface)
15
    {
16
        $this->softwareRepositoryInterface = $softwareRepositoryInterface;
17
        $this->authorizeResource(Software::class, 'software');
18
    }
19
20
    /**
21
     * Display a listing of the resource.
22
     *
23
     * @return \Illuminate\Http\Response
24
     */
25
    public function index()
26
    {
27
        return view('website::admin.software.index', $this->softwareRepositoryInterface->indexSoftware());
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...rface->indexSoftware()) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
28
    }
29
30
    /**
31
     * Show the form for creating a new resource.
32
     *
33
     * @return \Illuminate\Http\Response
34
     */
35
    public function create()
36
    {
37
        return view('website::admin.software.create');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::admin.software.create') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
38
    }
39
40
    /**
41
     * Store a newly created resource in storage.
42
     *
43
     * @param  \Adminetic\Website\Http\Requests\SoftwareRequest  $request
44
     * @return \Illuminate\Http\Response
45
     */
46
    public function store(SoftwareRequest $request)
47
    {
48
        $this->softwareRepositoryInterface->storeSoftware($request);
49
50
        return redirect(adminRedirectRoute('software'))->withSuccess('Software Created Successfully.');
0 ignored issues
show
Bug introduced by
The function adminRedirectRoute 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

50
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('software'))->withSuccess('Software Created Successfully.');
Loading history...
Bug Best Practice introduced by
The expression return redirect(adminRed...Created Successfully.') also could return the type Illuminate\Http\Redirect...nate\Routing\Redirector which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
51
    }
52
53
    /**
54
     * Display the specified resource.
55
     *
56
     * @param  \Adminetic\Website\Models\Admin\Software  $software
57
     * @return \Illuminate\Http\Response
58
     */
59
    public function show(Software $software)
60
    {
61
        return view('website::admin.software.show', $this->softwareRepositoryInterface->showSoftware($software));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...howSoftware($software)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
62
    }
63
64
    /**
65
     * Show the form for editing the specified resource.
66
     *
67
     * @param  \Adminetic\Website\Models\Admin\Software  $software
68
     * @return \Illuminate\Http\Response
69
     */
70
    public function edit(Software $software)
71
    {
72
        return view('website::admin.software.edit', $this->softwareRepositoryInterface->editSoftware($software));
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('website::ad...ditSoftware($software)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
73
    }
74
75
    /**
76
     * Update the specified resource in storage.
77
     *
78
     * @param  \Adminetic\Website\Http\Requests\SoftwareRequest  $request
79
     * @param  \Adminetic\Website\Models\Admin\Software  $software
80
     * @return \Illuminate\Http\Response
81
     */
82
    public function update(SoftwareRequest $request, Software $software)
83
    {
84
        $this->softwareRepositoryInterface->updateSoftware($request, $software);
85
86
        return redirect(adminRedirectRoute('software'))->withInfo('Software Updated Successfully.');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect(adminRed...Updated Successfully.') also could return the type Illuminate\Http\Redirect...nate\Routing\Redirector which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
The function adminRedirectRoute 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

86
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('software'))->withInfo('Software Updated Successfully.');
Loading history...
87
    }
88
89
    /**
90
     * Remove the specified resource from storage.
91
     *
92
     * @param  \Adminetic\Website\Models\Admin\Software  $software
93
     * @return \Illuminate\Http\Response
94
     */
95
    public function destroy(Software $software)
96
    {
97
        $this->softwareRepositoryInterface->destroySoftware($software);
98
99
        return redirect(adminRedirectRoute('software'))->withFail('Software Deleted Successfully.');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect(adminRed...Deleted Successfully.') also could return the type Illuminate\Http\Redirect...nate\Routing\Redirector which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Bug introduced by
The function adminRedirectRoute 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

99
        return redirect(/** @scrutinizer ignore-call */ adminRedirectRoute('software'))->withFail('Software Deleted Successfully.');
Loading history...
100
    }
101
}
102