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   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 41
Duplicated Lines 65.85 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 27
loc 41
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A table() 14 14 4
A entry() 13 13 4

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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