| Conditions | 1 |
| Paths | 1 |
| Total Lines | 89 |
| Code Lines | 59 |
| 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 |
||
| 22 | public function theTests() |
||
| 23 | { |
||
| 24 | return [[ |
||
| 25 | 'json' => '', |
||
| 26 | 'expect' => '', |
||
| 27 | ], [ |
||
| 28 | 'json' => '"', |
||
| 29 | 'expect' => '""', |
||
| 30 | ], [ |
||
| 31 | 'json' => '"a"', |
||
| 32 | 'expect' => '"a"', |
||
| 33 | ], [ |
||
| 34 | 'json' => 'true', |
||
| 35 | 'expect' => 'true', |
||
| 36 | ], [ |
||
| 37 | 'json' => 'false', |
||
| 38 | 'expect' => 'false', |
||
| 39 | ], [ |
||
| 40 | 'json' => 'null', |
||
| 41 | 'expect' => 'null', |
||
| 42 | ], [ |
||
| 43 | 'json' => 'fal', |
||
| 44 | 'expect' => 'false', |
||
| 45 | ], [ |
||
| 46 | 'json' => 't', |
||
| 47 | 'expect' => 'true', |
||
| 48 | ], [ |
||
| 49 | 'json' => 'nu', |
||
| 50 | 'expect' => 'null', |
||
| 51 | ], [ |
||
| 52 | 'json' => '{', |
||
| 53 | 'expect' => '{}', |
||
| 54 | ], [ |
||
| 55 | 'json' => '[', |
||
| 56 | 'expect' => '[]', |
||
| 57 | ], [ |
||
| 58 | 'json' => '[{', |
||
| 59 | 'expect' => '[{}]', |
||
| 60 | ], [ |
||
| 61 | 'json' => '[1', |
||
| 62 | 'expect' => '[1]', |
||
| 63 | ], [ |
||
| 64 | 'json' => '["', |
||
| 65 | 'expect' => '[""]', |
||
| 66 | ], [ |
||
| 67 | 'json' => '[1,', |
||
| 68 | 'expect' => '[1]', |
||
| 69 | ], [ |
||
| 70 | 'json' => '[1,{', |
||
| 71 | 'expect' => '[1,{}]', |
||
| 72 | ], [ |
||
| 73 | 'json' => '["a', |
||
| 74 | 'expect' => '["a"]', |
||
| 75 | ], [ |
||
| 76 | 'json' => '["b,', |
||
| 77 | 'expect' => '["b,"]', |
||
| 78 | ], [ |
||
| 79 | 'json' => '["b",{"', |
||
| 80 | 'expect' => '["b",{"":null}]', |
||
| 81 | ], [ |
||
| 82 | 'json' => '["b",{"a', |
||
| 83 | 'expect' => '["b",{"a":null}]', |
||
| 84 | ], [ |
||
| 85 | 'json' => '["b",{"a":', |
||
| 86 | 'expect' => '["b",{"a":null}]', |
||
| 87 | ], [ |
||
| 88 | 'json' => '["b",{"a":[t', |
||
| 89 | 'expect' => '["b",{"a":[true]}]', |
||
| 90 | ], [ |
||
| 91 | 'json' => '{"a":2', |
||
| 92 | 'expect' => '{"a":2}', |
||
| 93 | ], [ |
||
| 94 | 'json' => '{"', |
||
| 95 | 'expect' => '{"":null}', |
||
| 96 | ], [ |
||
| 97 | 'json' => '{"a":1.2,', |
||
| 98 | 'expect' => '{"a":1.2}', |
||
| 99 | ], [ |
||
| 100 | 'json' => '{"a":"', |
||
| 101 | 'expect' => '{"a":""}', |
||
| 102 | ], [ |
||
| 103 | 'json' => '{"a":[', |
||
| 104 | 'expect' => '{"a":[]}', |
||
| 105 | ], [ |
||
| 106 | 'json' => '{"a":"b","b":["', |
||
| 107 | 'expect' => '{"a":"b","b":[""]}', |
||
| 108 | ], [ |
||
| 109 | 'json' => '{"a":"b","b":[t', |
||
| 110 | 'expect' => '{"a":"b","b":[true]}', |
||
| 111 | ], |
||
| 115 |