Conditions | 1 |
Paths | 1 |
Total Lines | 83 |
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 |
||
124 | public function installFromLocal(\AcceptanceTester $I) |
||
125 | { |
||
126 | /* |
||
127 | * インストール |
||
128 | */ |
||
129 | $ManagePage = PluginLocalInstallPage::go($I) |
||
130 | ->アップロード('SamplePayment-1.0.0-beta-1.tgz'); |
||
131 | |||
132 | $I->see('プラグインをインストールしました。', PluginManagePage::完了メーッセージ); |
||
133 | |||
134 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
135 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
136 | |||
137 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
138 | $I->assertTrue($Plugin->isInitialized(), '初期化されていない'); |
||
139 | $I->assertFalse($Plugin->isEnabled(), '有効化されていない'); |
||
140 | |||
141 | /* |
||
142 | * 有効化 |
||
143 | */ |
||
144 | $ManagePage->独自プラグイン_有効化('SamplePayment'); |
||
145 | |||
146 | $I->see('「EC-CUBE Payment Sample Plugin」を有効にしました。', PluginManagePage::完了メーッセージ); |
||
147 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
148 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
149 | |||
150 | $this->em->refresh($Plugin); |
||
151 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
152 | $I->assertTrue($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->assertFalse($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->assertTrue($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->assertFalse($Plugin->isEnabled(), '無効化されている'); |
||
192 | |||
193 | /* |
||
194 | * 削除 |
||
195 | */ |
||
196 | $ManagePage->独自プラグイン_削除('SamplePayment'); |
||
197 | |||
198 | $I->see('プラグインを削除しました。', PluginManagePage::完了メーッセージ); |
||
199 | |||
200 | $I->assertFalse($this->tableExists('plg_sample_payment_config')); |
||
201 | $I->assertFalse($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
202 | |||
203 | $this->em->refresh($Plugin); |
||
204 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
205 | $I->assertNull($Plugin); |
||
206 | } |
||
207 | |||
218 |
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: