Conditions | 1 |
Paths | 1 |
Total Lines | 62 |
Code Lines | 49 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 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 |
||
116 | protected static function attributesMetadata(): array |
||
117 | { |
||
118 | return array ( |
||
119 | 'username' => |
||
120 | array ( |
||
121 | 'type' => |
||
122 | array ( |
||
123 | 0 => 'string', |
||
124 | 1 => 'int', |
||
125 | 2 => 'null', |
||
126 | ), |
||
127 | 'required' => false, |
||
128 | 'actionName' => 'username', |
||
129 | ), |
||
130 | 'books' => |
||
131 | array ( |
||
132 | 'type' => |
||
133 | array ( |
||
134 | 0 => 'iterable', |
||
135 | 1 => 'null', |
||
136 | ), |
||
137 | 'required' => false, |
||
138 | 'actionName' => 'books', |
||
139 | ), |
||
140 | 'first_name' => |
||
141 | array ( |
||
142 | 'type' => |
||
143 | array ( |
||
144 | 0 => 'string', |
||
145 | 1 => 'int', |
||
146 | ), |
||
147 | 'required' => true, |
||
148 | 'actionName' => 'firstName', |
||
149 | ), |
||
150 | 'updatedAt' => |
||
151 | array ( |
||
152 | 'type' => |
||
153 | array ( |
||
154 | 0 => 'DateTimeInterface', |
||
155 | 1 => 'null', |
||
156 | ), |
||
157 | 'required' => false, |
||
158 | 'actionName' => 'updatedAt', |
||
159 | ), |
||
160 | 'someclass' => |
||
161 | array ( |
||
162 | 'type' => |
||
163 | array ( |
||
164 | 0 => 'Micro\\Library\\DTO\\Object\\AbstractDto', |
||
165 | 1 => 'null', |
||
166 | ), |
||
167 | 'required' => false, |
||
168 | 'actionName' => 'someclass', |
||
169 | ), |
||
170 | 'testMixed' => |
||
171 | array ( |
||
172 | 'type' => |
||
173 | array ( |
||
174 | 0 => 'mixed', |
||
175 | ), |
||
176 | 'required' => false, |
||
177 | 'actionName' => 'testMixed', |
||
178 | ), |
||
182 |