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