| Conditions | 1 |
| Paths | 1 |
| Total Lines | 72 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 63 | public function testRenderPage() |
||
| 64 | { |
||
| 65 | $argSearch = []; |
||
| 66 | $argResult = [ |
||
| 67 | [ |
||
| 68 | "currently" => [ |
||
| 69 | "summary" => "test", |
||
| 70 | "precipProbability" => 1, |
||
| 71 | "temperature" => 1, |
||
| 72 | "apparentTemperature" => 1, |
||
| 73 | "windSpeed" => 1, |
||
| 74 | "windGust" => 1 |
||
| 75 | ], |
||
| 76 | "hourly" => [ |
||
| 77 | "summary" => "test", |
||
| 78 | "data" => [ |
||
| 79 | [ |
||
| 80 | "time" => 1576249313, |
||
| 81 | "summary" => "test", |
||
| 82 | "precipProbability" => 1, |
||
| 83 | "temperature" => 1, |
||
| 84 | "apparentTemperature" => 1, |
||
| 85 | "windSpeed" => 1, |
||
| 86 | "windGust" => 1 |
||
| 87 | ] |
||
| 88 | ] |
||
| 89 | ], |
||
| 90 | "daily" => [ |
||
| 91 | "summary" => "test", |
||
| 92 | "data" => [ |
||
| 93 | [ |
||
| 94 | "time" => 1576249313, |
||
| 95 | "summary" => "test", |
||
| 96 | "precipProbability" => 1, |
||
| 97 | "temperatureMin" => 1, |
||
| 98 | "temperatureMax" => 1, |
||
| 99 | "apparentTemperatureMin" => 1, |
||
| 100 | "apparentTemperatureMax" => 1, |
||
| 101 | "windSpeed" => 1, |
||
| 102 | "windGust" => 1 |
||
| 103 | ] |
||
| 104 | ] |
||
| 105 | ], |
||
| 106 | ], |
||
| 107 | [ |
||
| 108 | "daily" => [ |
||
| 109 | "data" => [ |
||
| 110 | [ |
||
| 111 | "time" => 1576249313, |
||
| 112 | "summary" => "test", |
||
| 113 | "precipProbability" => 1, |
||
| 114 | "temperatureMin" => 1, |
||
| 115 | "temperatureMax" => 1, |
||
| 116 | "apparentTemperatureMin" => 1, |
||
| 117 | "apparentTemperatureMax" => 1, |
||
| 118 | "windSpeed" => 1, |
||
| 119 | "windGust" => 1 |
||
| 120 | ] |
||
| 121 | ] |
||
| 122 | ] |
||
| 123 | ] |
||
| 124 | ]; |
||
| 125 | $argMapLink = "test"; |
||
| 126 | $argError = ""; |
||
| 127 | |||
| 128 | $result = $this->sut->renderPage($argSearch, $argResult, $argMapLink, $argError); |
||
| 129 | |||
| 130 | $this->assertIsArray($result); |
||
| 131 | $this->assertIsArray($result[0]); |
||
| 132 | $this->assertArrayHasKey("forecast", $result[0]); |
||
| 133 | $this->assertArrayHasKey("historical", $result[0]); |
||
| 134 | $this->assertArrayHasKey("poweredBy", $result[0]); |
||
| 135 | } |
||
| 153 |