| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 65 | 
| Code Lines | 32 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php | ||
| 39 | public function rules() | ||
| 40 |     { | ||
| 41 | return [ | ||
| 42 | [ | ||
| 43 | [ | ||
| 44 | 'about_id', | ||
| 45 | 'language_id', | ||
| 46 | ], | ||
| 47 | 'required' | ||
| 48 | ], | ||
| 49 | [ | ||
| 50 | [ | ||
| 51 | 'about_id', | ||
| 52 | 'language_id' | ||
| 53 | ], | ||
| 54 | 'integer' | ||
| 55 | ], | ||
| 56 | [ | ||
| 57 | [ | ||
| 58 | 'description', | ||
| 59 | 'content' | ||
| 60 | ], | ||
| 61 | 'string' | ||
| 62 | ], | ||
| 63 | [ | ||
| 64 | [ | ||
| 65 | 'created_at', | ||
| 66 | 'updated_at' | ||
| 67 | ], | ||
| 68 | 'safe' | ||
| 69 | ], | ||
| 70 | [ | ||
| 71 | [ | ||
| 72 | 'title', | ||
| 73 | 'metaKeys', | ||
| 74 | 'metaDescription' | ||
| 75 | ], | ||
| 76 | 'string', | ||
| 77 | 'max' => 255 | ||
| 78 | ], | ||
| 79 | [ | ||
| 80 | [ | ||
| 81 | 'about_id', | ||
| 82 | 'language_id' | ||
| 83 | ], | ||
| 84 | 'unique', | ||
| 85 | 'targetAttribute' => ['about_id', 'language_id'] | ||
| 86 | ], | ||
| 87 | [ | ||
| 88 | [ | ||
| 89 | 'about_id' | ||
| 90 | ], | ||
| 91 | 'exist', | ||
| 92 | 'skipOnError' => true, | ||
| 93 | 'targetClass' => About::class, | ||
| 94 | 'targetAttribute' => ['about_id' => 'id'] | ||
| 95 | ], | ||
| 96 | [ | ||
| 97 | [ | ||
| 98 | 'language_id' | ||
| 99 | ], | ||
| 100 | 'exist', | ||
| 101 | 'skipOnError' => true, | ||
| 102 | 'targetClass' => Language::class, | ||
| 103 | 'targetAttribute' => ['language_id' => 'id'] | ||
| 104 | ], | ||
| 146 |