| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| 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 |
||
| 109 | public function languageTargetLinksTemplateProvider() { |
||
| 110 | |||
| 111 | $provider = []; |
||
| 112 | |||
| 113 | $provider[] = [ |
||
| 114 | [ 'en' => 'Test' ], |
||
| 115 | '{{FakeTemplate' . |
||
| 116 | '|#=0' . |
||
| 117 | '|target-link=Test' . |
||
| 118 | '|lang-code=en' . |
||
| 119 | '|lang-name=English}}' |
||
| 120 | ]; |
||
| 121 | |||
| 122 | $provider[] = [ |
||
| 123 | [ 'ja' => \Title::newFromText( 'テスト' ) ], |
||
| 124 | '{{FakeTemplate' . |
||
| 125 | '|#=0' . |
||
| 126 | '|target-link=テスト' . |
||
| 127 | '|lang-code=ja' . |
||
| 128 | '|lang-name=日本語}}' |
||
| 129 | ]; |
||
| 130 | |||
| 131 | $provider[] = [ |
||
| 132 | [ 'zh-hans' => \Title::newFromText( '分类:汉字' ) ], |
||
| 133 | '{{FakeTemplate' . |
||
| 134 | '|#=0' . |
||
| 135 | '|target-link=分类:汉字' . |
||
| 136 | '|lang-code=zh-Hans' . |
||
| 137 | '|lang-name=中文(简体)}}' |
||
| 138 | ]; |
||
| 139 | |||
| 140 | $categoryNS = $GLOBALS['wgContLang']->getNsText( NS_CATEGORY ); |
||
| 141 | |||
| 142 | $provider[] = [ |
||
| 143 | [ 'zh-hans' => \Title::newFromText( 'Category:汉字' ) ], |
||
| 144 | '{{FakeTemplate' . |
||
| 145 | '|#=0' . |
||
| 146 | "|target-link=:$categoryNS:汉字" . |
||
| 147 | '|lang-code=zh-Hans' . |
||
| 148 | '|lang-name=中文(简体)}}' |
||
| 149 | ]; |
||
| 150 | |||
| 151 | $provider[] = [ |
||
| 152 | [ 'de' => 'Category:Foo' ], |
||
| 153 | '{{FakeTemplate' . |
||
| 154 | '|#=0' . |
||
| 155 | "|target-link=:$categoryNS:Foo" . |
||
| 156 | '|lang-code=de' . |
||
| 157 | '|lang-name=Deutsch}}' |
||
| 158 | ]; |
||
| 159 | |||
| 160 | return $provider; |
||
| 161 | } |
||
| 162 | |||
| 164 |