| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| Code Lines | 34 |
| 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 |
||
| 20 | public function serviceProvider() |
||
| 21 | { |
||
| 22 | $url = $this->getApiUrl(12, 'http://ez.no'); |
||
| 23 | |||
| 24 | return [ |
||
| 25 | [ |
||
| 26 | 'updateUrl', |
||
| 27 | [ |
||
| 28 | $url, |
||
| 29 | new URLUpdateStruct([ |
||
| 30 | 'url' => 'http://ezplatform.com', |
||
| 31 | ]), |
||
| 32 | ], |
||
| 33 | $this->getApiUrl(12, 'http://ezplatform.com', true), |
||
| 34 | 1, |
||
| 35 | UpdateUrlSignal::class, |
||
| 36 | ['urlId' => $url->id, 'urlChanged' => true], |
||
| 37 | ], |
||
| 38 | [ |
||
| 39 | 'updateUrl', |
||
| 40 | [ |
||
| 41 | $url, |
||
| 42 | new URLUpdateStruct([ |
||
| 43 | 'isValid' => false, |
||
| 44 | ]), |
||
| 45 | ], |
||
| 46 | $this->getApiUrl(12, 'http://ez.no', false), |
||
| 47 | 1, |
||
| 48 | UpdateUrlSignal::class, |
||
| 49 | ['urlId' => $url->id, 'urlChanged' => false], |
||
| 50 | ], |
||
| 51 | [ |
||
| 52 | 'createUpdateStruct', |
||
| 53 | [], |
||
| 54 | new URLUpdateStruct(), |
||
| 55 | 0, |
||
| 56 | ], |
||
| 57 | [ |
||
| 58 | 'findUrls', |
||
| 59 | [new URLQuery()], |
||
| 60 | new SearchResult(), |
||
| 61 | 0, |
||
| 62 | ], |
||
| 63 | [ |
||
| 64 | 'loadById', |
||
| 65 | [12], |
||
| 66 | $url, |
||
| 67 | 0, |
||
| 68 | ], |
||
| 69 | [ |
||
| 70 | 'loadByUrl', |
||
| 71 | ['http://ez.no'], |
||
| 72 | $url, |
||
| 73 | 0, |
||
| 74 | ], |
||
| 75 | ]; |
||
| 76 | } |
||
| 77 | |||
| 97 |