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

Crud::table()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 14
Code Lines 6

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
cc 4
eloc 6
nc 3
nop 1
dl 14
loc 14
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace Akibatech\Crud;
4
5
use Akibatech\Crud\Exceptions\InvalidArgumentException;
6
use Akibatech\Crud\Services\CrudEntry;
7
use Akibatech\Crud\Services\CrudTable;
8
use Akibatech\Crud\Traits\Crudable;
9
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
10
use Illuminate\Database\Eloquent\Collection;
11
use Illuminate\Database\Eloquent\Model;
12
13
/**
14
 * Class Factory
15
 *
16
 * @package Akibatech\Crud\Services
17
 */
18
class Crud
19
{
20
    /**
21
     * @param   string|Crudable $crudable
22
     * @return  CrudTable
23
     * @throws  InvalidArgumentException
24
     */
25 View Code Duplication
    public static function table($crudable)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
    {
27
        if (is_string($crudable))
28
        {
29
            return new CrudTable(new $crudable);
30
        }
31
32
        if (is_object($crudable) && array_key_exists(Crudable::class, class_uses($crudable)))
33
        {
34
            return new CrudTable($crudable);
35
        }
36
37
        throw new InvalidArgumentException("Argument must be Crudable.");
38
    }
39
40
    /**
41
     * @param   string|Crudable $crudable
42
     * @return  CrudEntry
43
     * @throws  InvalidArgumentException
44
     */
45 View Code Duplication
    public static function entry($crudable)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47
        if (is_string($crudable))
48
        {
49
            return new CrudEntry(new $crudable);
50
        }
51
        else if (is_object($crudable) && array_key_exists(Crudable::class, class_uses($crudable)))
52
        {
53
            return new CrudEntry($crudable);
54
        }
55
56
        throw new InvalidArgumentException("Argument must be Crudable.");
57
    }
58
}
59