We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 |
||
| 19 | class BackendController extends PluginEngine |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var PluginRepository |
||
| 23 | */ |
||
| 24 | private $plugins; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * BackendController constructor. |
||
| 28 | * @param PluginRepository $plugins |
||
| 29 | */ |
||
| 30 | public function __construct(PluginRepository $plugins) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Display a list of products available and disable, enable option for super admins. |
||
| 37 | */ |
||
| 38 | public function index() |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Steps required for the application install. |
||
| 45 | * Usually defined for logging & new sql entries. |
||
| 46 | * |
||
| 47 | * @param string $plugin_name |
||
| 48 | * @return mixed |
||
|
|
|||
| 49 | */ |
||
| 50 | View Code Duplication | public function install(string $plugin_name) |
|
| 71 | |||
| 72 | /** |
||
| 73 | * Steps required for the application uninstall. |
||
| 74 | * Usually defined for logging & new sql entries. |
||
| 75 | * |
||
| 76 | * @param string $plugin_name |
||
| 77 | * @return mixed |
||
| 78 | */ |
||
| 79 | View Code Duplication | public function uninstall(string $plugin_name) |
|
| 100 | } |
||
| 101 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.