| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| 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 |
||
| 88 | public function getGeoWithExtraFieldEdge() |
||
| 89 | { |
||
| 90 | $mockResponse = $this->getMockResponse( |
||
| 91 | [ |
||
| 92 | 'edge-country' => 'USA', |
||
| 93 | 'edge-region' => 'something', |
||
| 94 | 'edge-city' => 'reserved', |
||
| 95 | 'edge-conn-speed' => 'broadband', |
||
| 96 | 'edge-metro-code' => '2', |
||
| 97 | 'edge-latitude' => '123.456', |
||
| 98 | 'edge-longitude' => '789.101', |
||
| 99 | 'edge-postal-code' => '12345', |
||
| 100 | 'edge-country-code' => '112', |
||
| 101 | 'edge-region-code' => '1314', |
||
| 102 | 'edge-city-code' => '1516', |
||
| 103 | 'edge-continent-code' => '1', |
||
| 104 | 'edge-two-letter-country' => 'US', |
||
| 105 | 'edge-area-codes' => '123', |
||
| 106 | 'edge-country-conf' => '2', |
||
| 107 | 'edge-region-conf' => '3', |
||
| 108 | 'edge-city-conf' => '4', |
||
| 109 | 'edge-postal-conf' => '5', |
||
| 110 | 'edge-gmt-offset' => '6', |
||
| 111 | 'edge-in-dst' => '7', |
||
| 112 | 'edge-timezone-name' => 'UTC', |
||
| 113 | 'edge-extra' => 'erroneous', |
||
| 114 | ] |
||
| 115 | ); |
||
| 116 | $mockClient = $this->getMockGuzzleClient(); |
||
| 117 | $mockClient->method('send')->willReturn($mockResponse); |
||
| 118 | |||
| 119 | $database = new EdgeDatabase($mockClient, 'a token'); |
||
| 120 | |||
| 121 | $this->assertSame( |
||
| 122 | [ |
||
| 123 | 'area-code' => '123', |
||
| 124 | 'city' => 'reserved', |
||
| 125 | 'city-code' => '1516', |
||
| 126 | 'city-conf' => '4', |
||
| 127 | 'conn-speed' => 'broadband', |
||
| 128 | 'continent-code' => '1', |
||
| 129 | 'country' => 'USA', |
||
| 130 | 'country-code' => '112', |
||
| 131 | 'country-conf' => '2', |
||
| 132 | 'gmt-offset' => '6', |
||
| 133 | 'in-dist' => '7', |
||
| 134 | 'latitude' => '123.456', |
||
| 135 | 'longitude' => '789.101', |
||
| 136 | 'metro-code' => '2', |
||
| 137 | 'postal-conf' => '5', |
||
| 138 | 'region' => 'something', |
||
| 139 | 'region-code' => '1314', |
||
| 140 | 'region-conf' => '3', |
||
| 141 | 'timezone-name' => 'UTC', |
||
| 142 | 'two-letter-country' => 'US', |
||
| 143 | 'zip-code' => '12345', |
||
| 144 | ], |
||
| 145 | $database->fetch('1.2.3.4') |
||
| 146 | ); |
||
| 147 | } |
||
| 148 | |||
| 187 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.