| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 38 |
| 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 |
||
| 33 | public function parseDataProvider() |
||
| 34 | { |
||
| 35 | return [ |
||
| 36 | [ |
||
| 37 | '{% $tagName "secure1" %}{% end$tagName %}', |
||
| 38 | new RouteExpression( |
||
| 39 | new Node([ |
||
| 40 | new ConstantExpression('secure1', 0), |
||
| 41 | ]) |
||
| 42 | ), |
||
| 43 | ], |
||
| 44 | [ |
||
| 45 | '{% $tagName "secure1", {page: 10} %}{% end$tagName %}', |
||
| 46 | new RouteExpression( |
||
| 47 | new Node([ |
||
| 48 | new ConstantExpression('secure1', 0), |
||
| 49 | new ArrayExpression([ |
||
| 50 | new ConstantExpression('page', 0), |
||
| 51 | new ConstantExpression(10, 0), |
||
| 52 | ], 0), |
||
| 53 | ]) |
||
| 54 | ), |
||
| 55 | ], |
||
| 56 | [ |
||
| 57 | '{% $tagName "secure1", {}, "POST" %}{% end$tagName %}', |
||
| 58 | new RouteExpression( |
||
| 59 | new Node([ |
||
| 60 | new ConstantExpression('secure1', 0), |
||
| 61 | new ArrayExpression([], 0), |
||
| 62 | new ConstantExpression('POST', 0), |
||
| 63 | ]) |
||
| 64 | ), |
||
| 65 | ], |
||
| 66 | [ |
||
| 67 | '{% $tagName "secure1" as path %}{% end$tagName %}', |
||
| 68 | (new RouteExpression( |
||
| 69 | new Node([ |
||
| 70 | new ConstantExpression('secure1', 0), |
||
| 71 | ]) |
||
| 72 | ))->setGenerateAs('path', false), |
||
| 73 | ], |
||
| 74 | [ |
||
| 75 | '{% $tagName "secure1" as path relative %}{% end$tagName %}', |
||
| 76 | (new RouteExpression( |
||
| 77 | new Node([ |
||
| 78 | new ConstantExpression('secure1', 0), |
||
| 79 | ]) |
||
| 80 | ))->setGenerateAs('path', true), |
||
| 81 | ], |
||
| 82 | |||
| 83 | [ |
||
| 84 | '{% $tagName "secure1" as path absolute %}{% end$tagName %}', |
||
| 85 | (new RouteExpression( |
||
| 86 | new Node([ |
||
| 87 | new ConstantExpression('secure1', 0), |
||
| 88 | ]) |
||
| 89 | ))->setGenerateAs('path', false), |
||
| 90 | ], |
||
| 91 | |||
| 92 | [ |
||
| 93 | '{% $tagName "secure1" as url %}{% end$tagName %}', |
||
| 94 | (new RouteExpression( |
||
| 95 | new Node([ |
||
| 96 | new ConstantExpression('secure1', 0), |
||
| 97 | ]) |
||
| 98 | ))->setGenerateAs('url', false), |
||
| 99 | ], |
||
| 139 |