| Conditions | 1 |
| Paths | 1 |
| Total Lines | 76 |
| Code Lines | 36 |
| 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 |
||
| 41 | public function setUp() |
||
| 42 | { |
||
| 43 | $this->router = $this->getMockBuilder('\Symfony\Bundle\FrameworkBundle\Routing\Router') |
||
| 44 | ->disableOriginalConstructor() |
||
| 45 | ->setMethods(['getRouteCollection', 'generate']) |
||
| 46 | ->getMock(); |
||
| 47 | |||
| 48 | $this->collection = $this->getMockBuilder('\Symfony\Bundle\FrameworkBundle\Routing\RouteCollection') |
||
| 49 | ->setMethods(['all']) |
||
| 50 | ->getMock(); |
||
| 51 | |||
| 52 | $this->routes = [ |
||
| 53 | new Route( |
||
| 54 | '/core/app/{id}', |
||
| 55 | [ |
||
| 56 | '_controller' => 'graviton.core.controller.app:getAction', |
||
| 57 | '_format' => '~' |
||
| 58 | ], |
||
| 59 | [ |
||
| 60 | 'id' => '[a-zA-Z0-9\-_\/]+', |
||
| 61 | ], |
||
| 62 | [], |
||
| 63 | '', |
||
| 64 | [], |
||
| 65 | [ |
||
| 66 | 'GET' |
||
| 67 | ] |
||
| 68 | ), |
||
| 69 | new Route( |
||
| 70 | '/core/app', |
||
| 71 | [ |
||
| 72 | '_controller' => 'graviton.core.controller.app.appAction', |
||
| 73 | '_format' => '~' |
||
| 74 | ], |
||
| 75 | [], |
||
| 76 | [], |
||
| 77 | '', |
||
| 78 | [], |
||
| 79 | [ |
||
| 80 | 'GET' |
||
| 81 | ] |
||
| 82 | ), |
||
| 83 | new Route( |
||
| 84 | '/i18n/language/{id}', |
||
| 85 | [ |
||
| 86 | '_controller' => 'graviton.i18n.controller.language:getAction', |
||
| 87 | '_format' => '~' |
||
| 88 | ], |
||
| 89 | [ |
||
| 90 | 'id' => '[a-zA-Z0-9\-_\/]+', |
||
| 91 | ], |
||
| 92 | [], |
||
| 93 | '', |
||
| 94 | [], |
||
| 95 | [ |
||
| 96 | 'GET' |
||
| 97 | ] |
||
| 98 | ), |
||
| 99 | new Route( |
||
| 100 | '/hans/showcase/{id}', |
||
| 101 | [ |
||
| 102 | '_controller' => 'gravitondyn.showcase.controller.showcase:getAction', |
||
| 103 | '_format' => '~' |
||
| 104 | ], |
||
| 105 | [ |
||
| 106 | 'id' => '[a-zA-Z0-9\-_\/]+', |
||
| 107 | ], |
||
| 108 | [], |
||
| 109 | '', |
||
| 110 | [], |
||
| 111 | [ |
||
| 112 | 'GET' |
||
| 113 | ] |
||
| 114 | ), |
||
| 115 | ]; |
||
| 116 | } |
||
| 117 | |||
| 222 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.