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 Distilleries\Expendable\Http\Forms\Language; |
||
6 | class LanguageForm extends FormValidator { |
||
7 | |||
8 | public static $rules = [ |
||
9 | 'libelle' => 'required', |
||
10 | 'iso' => 'required|unique:languages', |
||
11 | 'not_visible' => 'required|integer', |
||
12 | 'is_default' => 'required|integer', |
||
13 | 'status' => 'required|integer' |
||
14 | ]; |
||
15 | |||
16 | public function buildForm() |
||
43 | |||
44 | View Code Duplication | protected function getUpdateRules() |
|
51 | } |