Conditions | 11 |
Paths | 513 |
Total Lines | 32 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 132 |
Changes | 1 | ||
Bugs | 1 | 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 |
||
23 | public function __construct(\stdClass $response = null) |
||
24 | { |
||
25 | if (null !== $response) { |
||
26 | if (isset($response->BusinessTransitDays)) { |
||
27 | $this->BusinessTransitDays = $response->BusinessTransitDays; |
||
28 | } |
||
29 | if (isset($response->Arrival)) { |
||
30 | $this->Arrival = new Arrival($response->Arrival); |
||
31 | } |
||
32 | if (isset($response->Pickup)) { |
||
33 | $this->Pickup = new Pickup($response->Pickup); |
||
34 | } |
||
35 | if (isset($response->HolidayCount)) { |
||
36 | $this->HolidayCount = $response->HolidayCount; |
||
37 | } |
||
38 | if (isset($response->DelayCount)) { |
||
39 | $this->DelayCount = $response->DelayCount; |
||
40 | } |
||
41 | if (isset($response->DayOfWeek)) { |
||
42 | $this->DayOfWeek = $response->DayOfWeek; |
||
43 | } |
||
44 | if (isset($response->TotalTransitDays)) { |
||
45 | $this->TotalTransitDays = $response->TotalTransitDays; |
||
46 | } |
||
47 | if (isset($response->CustomerCenterCutoff)) { |
||
48 | $this->CustomerCenterCutoff = $response->CustomerCenterCutoff; |
||
49 | } |
||
50 | if (isset($response->RestDays)) { |
||
51 | $this->RestDays = $response->RestDays; |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 | } |
||
56 |