| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 34 |
| 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 |
||
| 106 | public function testLanguageSwitchLinks() { |
||
| 107 | // TODO: Check cache metadata. |
||
| 108 | $metadata = $this->defaultCacheMetaData(); |
||
| 109 | |||
| 110 | $this->assertResults($this->getQueryFromFile('language_switch_links.gql'), [], [ |
||
| 111 | 'route' => [ |
||
| 112 | 'links' => [ |
||
| 113 | 0 => [ |
||
| 114 | 'language' => [ |
||
| 115 | 'id' => 'en', |
||
| 116 | ], |
||
| 117 | 'url' => [ |
||
| 118 | 'path' => '/en', |
||
| 119 | ], |
||
| 120 | 'title' => 'English', |
||
| 121 | 'active' => TRUE, |
||
| 122 | ], |
||
| 123 | 1 => [ |
||
| 124 | 'language' => [ |
||
| 125 | 'id' => 'fr', |
||
| 126 | ], |
||
| 127 | 'url' => [ |
||
| 128 | 'path' => '/fr', |
||
| 129 | ], |
||
| 130 | 'title' => NULL, |
||
| 131 | 'active' => FALSE, |
||
| 132 | ], |
||
| 133 | 2 => [ |
||
| 134 | 'language' => [ |
||
| 135 | 'id' => 'es', |
||
| 136 | ], |
||
| 137 | 'url' => [ |
||
| 138 | 'path' => '/es', |
||
| 139 | ], |
||
| 140 | 'title' => NULL, |
||
| 141 | 'active' => FALSE, |
||
| 142 | ], |
||
| 143 | 3 => [ |
||
| 144 | 'language' => [ |
||
| 145 | 'id' => 'pt-br', |
||
| 146 | ], |
||
| 147 | 'url' => [ |
||
| 148 | 'path' => '/', |
||
| 149 | ], |
||
| 150 | 'title' => NULL, |
||
| 151 | 'active' => FALSE, |
||
| 152 | ], |
||
| 153 | ], |
||
| 154 | ], |
||
| 155 | ], $metadata); |
||
| 156 | } |
||
| 157 | } |
||
| 158 |