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  | 
            ||
| 14 | View Code Duplication | class CityLink extends \Model { | 
            |
| 15 | |||
| 16 | public static $labels = [  | 
            ||
| 17 | 'delivery_id' => 'Тип доставки',  | 
            ||
| 18 | 'city_id' => 'Город',  | 
            ||
| 19 | 'date_create' => 'Дата создания'  | 
            ||
| 20 | ];  | 
            ||
| 21 | public static $cols = [  | 
            ||
| 22 | 'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],  | 
            ||
| 23 | 'city_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'city'],  | 
            ||
| 24 | 'weight' => ['type' => 'number'],  | 
            ||
| 25 | 'date_create' => ['type' => 'dateTime']  | 
            ||
| 26 | ];  | 
            ||
| 27 | public static $dataManagers = [  | 
            ||
| 28 | 'manager' => [  | 
            ||
| 29 | 'name' => 'Города доставки',  | 
            ||
| 30 | 'cols' => ['city_id', 'date_create'],  | 
            ||
| 31 | 'sortMode' => true  | 
            ||
| 32 | ]  | 
            ||
| 33 | ];  | 
            ||
| 34 | public static $forms = [  | 
            ||
| 35 | 'manager' => [  | 
            ||
| 36 | 'map' => [  | 
            ||
| 37 | ['delivery_id', 'city_id'],  | 
            ||
| 38 | ]  | 
            ||
| 39 | ]  | 
            ||
| 40 | ];  | 
            ||
| 41 | |||
| 42 |     public static function relations() { | 
            ||
| 54 | |||
| 55 | }  | 
            ||
| 56 |