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 CosmicRadioTV\Podcast\Controllers; |
||
11 | class Episodes extends Controller |
||
12 | { |
||
13 | public $implement = [ |
||
14 | 'Backend.Behaviors.FormController', |
||
15 | 'Backend.Behaviors.ListController', |
||
16 | 'Backend.Behaviors.RelationController', |
||
17 | ]; |
||
18 | |||
19 | public $formConfig = 'config_form.yaml'; |
||
20 | public $listConfig = 'config_list.yaml'; |
||
21 | public $relationConfig = 'config_relation.yaml'; |
||
22 | |||
23 | public $requiredPermissions = ['cosmicradiotv.podcast.access_episode*']; |
||
24 | |||
25 | public function __construct() |
||
31 | |||
32 | public function index_onDelete() |
||
48 | |||
49 | View Code Duplication | public function listExtendQuery($query, $definition = null) { |
|
66 | } |