Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 12 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | public function validatePlugin($plugin) |
||
42 | { |
||
43 | if ($plugin instanceof ResourceLoaderInterface) { |
||
44 | return; |
||
45 | } |
||
46 | |||
47 | throw new Exception\RuntimeException(sprintf( |
||
48 | 'Plugin of type %s is invalid; must implement %s', |
||
49 | (is_object($plugin) ? get_class($plugin) : gettype($plugin)), |
||
50 | ResourceLoaderInterface::class |
||
51 | )); |
||
52 | } |
||
53 | } |
||
54 |
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.