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