Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#23)
by
unknown
01:47
created

MenuCrudController::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 29
rs 8.8571
cc 1
eloc 20
nc 1
nop 0
1
<?php
2
3
namespace Backpack\MenuCRUD\app\Http\Controllers\Admin;
4
5
use App\Http\Requests;
6
use Backpack\CRUD\app\Http\Controllers\CrudController;
7
// VALIDATION: change the requests to match your own file names if you need form validation
8
use Backpack\CRUD\app\Http\Requests\CrudRequest as StoreRequest;
9
use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest;
10
11
class MenuCrudController extends CrudController
12
{
13
    public function __construct()
14
    {
15
        parent::__construct();
16
17
        $this->crud->setModel("Backpack\MenuCRUD\app\Models\Menu");
18
        $this->crud->setRoute(config('backpack.base.route_prefix').'/menu');
19
        $this->crud->setEntityNameStrings('menu', 'menus');
20
21
        $this->crud->allowAccess('reorder');
22
        $this->crud->enableReorder('name', 2);
23
24
        $this->crud->addColumn([
25
                                'name' => 'name',
26
                                'label' => 'Label',
27
                            ]);;
0 ignored issues
show
Coding Style introduced by
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
28
29
        $this->crud->addField([
30
                                'name' => 'name',
31
                                'label' => 'Label',
32
                            ]);
33
        $this->crud->addField([
34
                                'label' => 'Name',
35
                                'type' => 'text',
36
                                'name' => 'name',
37
                                'entity' => 'parent',
38
                                'attribute' => 'name',
39
                                'model' => "\Backpack\MenuCRUD\app\Models\Menu",
40
                            ]);
41
    }
42
43
    public function store(StoreRequest $request)
44
    {
45
        return parent::storeCrud($request);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (storeCrud() instead of store()). Are you sure this is correct? If so, you might want to change this to $this->storeCrud().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
46
    }
47
48
    public function update(UpdateRequest $request)
49
    {
50
        return parent::updateCrud($request);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (updateCrud() instead of update()). Are you sure this is correct? If so, you might want to change this to $this->updateCrud().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
51
    }
52
}
53