Conditions | 1 |
Paths | 1 |
Total Lines | 81 |
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 |
||
42 | public function installFromStore(\AcceptanceTester $I) |
||
43 | { |
||
44 | /* |
||
45 | * インストール |
||
46 | */ |
||
47 | |||
48 | $ManagePage = PluginSearchPage::go($I) |
||
49 | ->入手する('SamplePayment') |
||
50 | ->インストール(); |
||
51 | |||
52 | $I->assertFalse($this->tableExists('plg_sample_payment_config')); |
||
53 | $I->assertFalse($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
54 | |||
55 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
56 | $I->assertFalse($Plugin->isInitialized(), '初期化されていない'); |
||
57 | $I->assertFalse($Plugin->isEnabled(), '有効化されていない'); |
||
58 | |||
59 | /* |
||
60 | * 有効化 |
||
61 | */ |
||
62 | $ManagePage->ストアプラグイン_有効化('SamplePayment'); |
||
63 | |||
64 | $I->see('「EC-CUBE Payment Sample Plugin」を有効にしました。', PluginManagePage::完了メーッセージ); |
||
65 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
66 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
67 | |||
68 | $this->em->refresh($Plugin); |
||
|
|||
69 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
70 | $I->assertTrue($Plugin->isEnabled(), '有効化されている'); |
||
71 | |||
72 | /* |
||
73 | * 無効化 |
||
74 | */ |
||
75 | $ManagePage->ストアプラグイン_無効化('SamplePayment'); |
||
76 | |||
77 | $I->see('「EC-CUBE Payment Sample Plugin」を無効にしました。', PluginManagePage::完了メーッセージ); |
||
78 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
79 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
80 | |||
81 | $this->em->refresh($Plugin); |
||
82 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
83 | $I->assertFalse($Plugin->isEnabled(), '無効化されている'); |
||
84 | |||
85 | /* |
||
86 | * 再度有効化 |
||
87 | */ |
||
88 | $ManagePage->ストアプラグイン_有効化('SamplePayment'); |
||
89 | |||
90 | $I->see('「EC-CUBE Payment Sample Plugin」を有効にしました。', PluginManagePage::完了メーッセージ); |
||
91 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
92 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
93 | |||
94 | $this->em->refresh($Plugin); |
||
95 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
96 | $I->assertTrue($Plugin->isEnabled(), '有効化されている'); |
||
97 | |||
98 | /* |
||
99 | * 再度無効化 |
||
100 | */ |
||
101 | $ManagePage->ストアプラグイン_無効化('SamplePayment'); |
||
102 | |||
103 | $I->see('「EC-CUBE Payment Sample Plugin」を無効にしました。', PluginManagePage::完了メーッセージ); |
||
104 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
105 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
106 | |||
107 | $this->em->refresh($Plugin); |
||
108 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
109 | $I->assertFalse($Plugin->isEnabled(), '無効化されている'); |
||
110 | |||
111 | /* |
||
112 | * 削除 |
||
113 | */ |
||
114 | $ManagePage->ストアプラグイン_削除('SamplePayment'); |
||
115 | |||
116 | $I->assertFalse($this->tableExists('plg_sample_payment_config')); |
||
117 | $I->assertFalse($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
118 | |||
119 | $this->em->refresh($Plugin); |
||
120 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
121 | $I->assertNull($Plugin); |
||
122 | } |
||
123 | |||
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: