Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 17 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
22 | View Code Duplication | public static function table($crudable) |
|
|
|||
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 | |||
63 |
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.