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 namespace Bedard\Shop\Controllers; |
||
| 9 | View Code Duplication | class Customers extends BackendController |
|
| 10 | { |
||
| 11 | public $formConfig = 'config_form.yaml'; |
||
| 12 | |||
| 13 | public $listConfig = 'config_list.yaml'; |
||
| 14 | |||
| 15 | public $implement = [ |
||
| 16 | 'Backend.Behaviors.FormController', |
||
| 17 | 'Backend.Behaviors.ListController', |
||
| 18 | 'Owl.Behaviors.ListDelete.Behavior', |
||
| 19 | ]; |
||
| 20 | |||
| 21 | public $registerPermissions = [ |
||
| 22 | 'bedard.shop.customers.manage', |
||
| 23 | ]; |
||
| 24 | |||
| 25 | public function __construct() |
||
| 32 | } |
||
| 33 |