| Conditions | 13 |
| Paths | 4096 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 182 |
| 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 |
||
| 45 | public static function buildFromArray($mission_data) { |
||
| 46 | $that = new static(); |
||
| 47 | |||
| 48 | $that->fleet = is_array($mission_data['fleet']) && !empty($mission_data['fleet']) ? $mission_data['fleet'] : null; |
||
| 49 | $that->dst_user = is_array($mission_data['dst_user']) && !empty($mission_data['dst_user']) ? $mission_data['dst_user'] : null; |
||
| 50 | $that->dst_planet = is_array($mission_data['dst_planet']) && !empty($mission_data['dst_planet']) ? $mission_data['dst_planet'] : null; |
||
| 51 | $that->src_user = is_array($mission_data['src_user']) && !empty($mission_data['src_user']) ? $mission_data['src_user'] : null; |
||
| 52 | $that->src_planet = is_array($mission_data['src_planet']) && !empty($mission_data['src_planet']) ? $mission_data['src_planet'] : null; |
||
| 53 | $that->fleet_event = is_array($mission_data['fleet_event']) && !empty($mission_data['fleet_event']) ? $mission_data['fleet_event'] : null; |
||
| 54 | |||
| 55 | return $that; |
||
| 56 | } |
||
| 57 | |||
| 59 |