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 ( 4e0f46...61af64 )
by Marceau
03:34
created

Crud::table()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 17
Code Lines 8

Duplication

Lines 17
Ratio 100 %

Importance

Changes 0
Metric Value
cc 5
eloc 8
nc 4
nop 1
dl 17
loc 17
rs 8.8571
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
10
/**
11
 * Class Factory
12
 *
13
 * @package Akibatech\Crud\Services
14
 */
15
class Crud
16
{
17
    /**
18
     * @param   string|Crudable $crudable
19
     * @return  CrudTable
20
     * @throws  InvalidArgumentException
21
     */
22 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...
23
    {
24
        if (is_string($crudable))
25
        {
26
            return new CrudTable(new $crudable);
27
        }
28
        else if ($crudable instanceof CrudTable)
29
        {
30
            return $crudable;
31
        }
32
        else 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 ($crudable instanceof CrudEntry)
52
        {
53
            return $crudable;
54
        }
55
        else if (is_object($crudable) && array_key_exists(Crudable::class, class_uses($crudable)))
56
        {
57
            return new CrudEntry($crudable);
58
        }
59
60
        throw new InvalidArgumentException("Argument must be Crudable.");
61
    }
62
}
63