| Conditions | 1 |
| Paths | 1 |
| Total Lines | 84 |
| 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 |
||
| 137 | public function installFromLocal(\AcceptanceTester $I) |
||
| 138 | { |
||
| 139 | /* |
||
| 140 | * インストール |
||
| 141 | */ |
||
| 142 | $ManagePage = PluginLocalInstallPage::go($I) |
||
| 143 | ->アップロード('SamplePayment-0.9.0.tgz'); |
||
| 144 | |||
| 145 | $I->see('プラグインをインストールしました。', PluginManagePage::完了メーッセージ); |
||
| 146 | |||
| 147 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 148 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 149 | |||
| 150 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
| 151 | $I->assertTrue($Plugin->isInitialized(), '初期化されていない'); |
||
| 152 | $I->assertFalse($Plugin->isEnabled(), '有効化されていない'); |
||
| 153 | |||
| 154 | /* |
||
| 155 | * 有効化 |
||
| 156 | */ |
||
| 157 | $ManagePage->独自プラグイン_有効化('SamplePayment'); |
||
| 158 | |||
| 159 | $I->see('「EC-CUBE Payment Sample Plugin」を有効にしました。', PluginManagePage::完了メーッセージ); |
||
| 160 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 161 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 162 | |||
| 163 | $this->em->refresh($Plugin); |
||
| 164 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 165 | $I->assertTrue($Plugin->isEnabled(), '有効化されている'); |
||
| 166 | |||
| 167 | /* |
||
| 168 | * 無効化 |
||
| 169 | */ |
||
| 170 | $ManagePage->独自プラグイン_無効化('SamplePayment'); |
||
| 171 | |||
| 172 | $I->see('「EC-CUBE Payment Sample Plugin」を無効にしました。', PluginManagePage::完了メーッセージ); |
||
| 173 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 174 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 175 | |||
| 176 | $this->em->refresh($Plugin); |
||
| 177 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 178 | $I->assertFalse($Plugin->isEnabled(), '無効化されている'); |
||
| 179 | |||
| 180 | /* |
||
| 181 | * 再度有効化 |
||
| 182 | */ |
||
| 183 | $ManagePage->独自プラグイン_有効化('SamplePayment'); |
||
| 184 | |||
| 185 | $I->see('「EC-CUBE Payment Sample Plugin」を有効にしました。', PluginManagePage::完了メーッセージ); |
||
| 186 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 187 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 188 | |||
| 189 | $this->em->refresh($Plugin); |
||
| 190 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 191 | $I->assertTrue($Plugin->isEnabled(), '有効化されている'); |
||
| 192 | |||
| 193 | /* |
||
| 194 | * 再度無効化 |
||
| 195 | */ |
||
| 196 | $ManagePage->独自プラグイン_無効化('SamplePayment'); |
||
| 197 | |||
| 198 | $I->see('「EC-CUBE Payment Sample Plugin」を無効にしました。', PluginManagePage::完了メーッセージ); |
||
| 199 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 200 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 201 | |||
| 202 | $this->em->refresh($Plugin); |
||
| 203 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 204 | $I->assertFalse($Plugin->isEnabled(), '無効化されている'); |
||
| 205 | |||
| 206 | /* |
||
| 207 | * 削除 |
||
| 208 | */ |
||
| 209 | $ManagePage->独自プラグイン_削除('SamplePayment'); |
||
| 210 | |||
| 211 | $I->see('プラグインを削除しました。', PluginManagePage::完了メーッセージ); |
||
| 212 | |||
| 213 | $I->assertFalse($this->tableExists('plg_sample_payment_config')); |
||
| 214 | $I->assertFalse($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 215 | |||
| 216 | $this->em->refresh($Plugin); |
||
| 217 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
| 218 | $I->assertNull($Plugin); |
||
| 219 | |||
| 220 | } |
||
| 221 | |||
| 231 | } |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: