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.
Completed
Push — master ( 413ca6...9053fe )
by Marceau
03:52
created

Crudable::crudTable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Akibatech\Crud\Traits;
4
5
use Akibatech\Crud\Crud;
6
use Akibatech\Crud\Services\CrudEntry;
7
use Akibatech\Crud\Services\CrudFields;
8
use Akibatech\Crud\Services\CrudManager;
9
use Akibatech\Crud\Services\CrudTable;
10
11
/**
12
 * Class Crudable
13
 *
14
 * @package Akibatech\Crud\Traits\Crudable
15
 */
16
trait Crudable
17
{
18
    /**
19
     * @var CrudEntry
20
     */
21
    protected $crud_entry;
22
23
    /**
24
     * @var CrudTable
25
     */
26
    protected $crud_table;
27
28
    /**
29
     * @param   void
30
     * @return  CrudEntry
31
     * @throws  \Akibatech\Crud\Exceptions\InvalidArgumentException
32
     */
33
    public function crudEntry()
34
    {
35
        if (is_null($this->crud_entry))
36
        {
37
            $this->crud_entry = Crud::entry($this);
38
        }
39
40
        return $this->crud_entry;
41
    }
42
43
    /**
44
     * @param   void
45
     * @return  CrudTable
46
     * @throws  \Akibatech\Crud\Exceptions\InvalidArgumentException
47
     */
48
    public function crudTable()
49
    {
50
        if (is_null($this->crud_table))
51
        {
52
            $this->crud_table = Crud::table($this);
53
        }
54
55
        return $this->crud_table;
56
    }
57
58
    /**
59
     * Returns model fields configuration.
60
     *
61
     * @param   void
62
     * @return  CrudFields
63
     */
64
    abstract public function getCrudFields();
65
66
    /**
67
     * Returns the CRUD configuration.
68
     *
69
     * @param   void
70
     * @return  CrudManager
71
     */
72
    abstract public function getCrudManager();
73
74
    /**
75
     * @param   void
76
     * @return  static
77
     */
78
    public static function crudRoutes()
79
    {
80
        $routes = (new static)->getCrudManager()->registerRoutes();
0 ignored issues
show
Unused Code introduced by
$routes is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
81
    }
82
}
83