Conditions | 9 |
Paths | 9 |
Total Lines | 136 |
Code Lines | 94 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
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 |
||
105 | private function configureSms(InputInterface $input, OutputInterface $output) { |
||
106 | $helper = $this->getHelper('question'); |
||
107 | $providerQuestion = new Question('Please choose a SMS provider (websms, playsms, clockworksms, puzzelsms, ecallsms, voipms, huawei_e3531, spryng): ', 'websms'); |
||
108 | $provider = $helper->ask($input, $output, $providerQuestion); |
||
109 | |||
110 | /** @var SMSConfig $config */ |
||
111 | $config = $this->smsGateway->getConfig(); |
||
112 | switch ($provider) { |
||
113 | case 'websms': |
||
114 | $config->setProvider($provider); |
||
115 | /** @var WebSmsConfig $providerConfig */ |
||
116 | $providerConfig = $config->getProvider()->getConfig(); |
||
117 | |||
118 | $usernameQuestion = new Question('Please enter your websms.de username: '); |
||
119 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
120 | $passwordQuestion = new Question('Please enter your websms.de password: '); |
||
121 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
122 | |||
123 | $providerConfig->setUser($username); |
||
124 | $providerConfig->setPassword($password); |
||
125 | |||
126 | break; |
||
127 | case 'playsms': |
||
128 | $config->setProvider($provider); |
||
129 | /** @var PlaySMSConfig $providerConfig */ |
||
130 | $providerConfig = $config->getProvider()->getConfig(); |
||
131 | |||
132 | $urlQuestion = new Question('Please enter your PlaySMS URL: '); |
||
133 | $url = $helper->ask($input, $output, $urlQuestion); |
||
134 | $usernameQuestion = new Question('Please enter your PlaySMS username: '); |
||
135 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
136 | $passwordQuestion = new Question('Please enter your PlaySMS password: '); |
||
137 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
138 | |||
139 | $providerConfig->setUrl($url); |
||
140 | $providerConfig->setUser($username); |
||
141 | $providerConfig->setPassword($password); |
||
142 | |||
143 | break; |
||
144 | case 'clockworksms': |
||
145 | $config->setProvider($provider); |
||
146 | /** @var ClockworkSMSConfig $providerConfig */ |
||
147 | $providerConfig = $config->getProvider()->getConfig(); |
||
148 | |||
149 | $apitokenQuestion = new Question('Please enter your clockworksms api token: '); |
||
150 | $apitoken = $helper->ask($input, $output, $apitokenQuestion); |
||
151 | |||
152 | $providerConfig->setApiToken($apitoken); |
||
153 | |||
154 | break; |
||
155 | case 'puzzelsms': |
||
156 | $config->setProvider($provider); |
||
157 | |||
158 | /** @var PuzzelSMSConfig $providerConfig */ |
||
159 | $providerConfig = $config->getProvider()->getConfig(); |
||
160 | |||
161 | $urlQuestion = new Question('Please enter your PuzzelSMS URL: '); |
||
162 | $url = $helper->ask($input, $output, $urlQuestion); |
||
163 | |||
164 | $usernameQuestion = new Question('Please enter your PuzzelSMS username: '); |
||
165 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
166 | |||
167 | $passwordQuestion = new Question('Please enter your PuzzelSMS password: '); |
||
168 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
169 | |||
170 | $serviceQuestion = new Question('Please enter your PuzzelSMS service ID: '); |
||
171 | $serviceId = $helper->ask($input, $output, $serviceQuestion); |
||
172 | |||
173 | $providerConfig->setUrl($url); |
||
174 | $providerConfig->setUser($username); |
||
175 | $providerConfig->setPassword($password); |
||
176 | $providerConfig->setServiceId($serviceId); |
||
177 | break; |
||
178 | case 'ecallsms': |
||
179 | $config->setProvider($provider); |
||
180 | /** @var EcallSMSConfig $providerConfig */ |
||
181 | $providerConfig = $config->getProvider()->getConfig(); |
||
182 | |||
183 | $usernameQuestion = new Question('Please enter your eCall.ch username: '); |
||
184 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
185 | $passwordQuestion = new Question('Please enter your eCall.ch password: '); |
||
186 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
187 | $senderIdQuestion = new Question('Please enter your eCall.ch sender ID: '); |
||
188 | $senderId = $helper->ask($input, $output, $senderIdQuestion); |
||
189 | |||
190 | $providerConfig->setUser($username); |
||
191 | $providerConfig->setPassword($password); |
||
192 | $providerConfig->setSenderId($senderId); |
||
193 | break; |
||
194 | |||
195 | case 'voipms': |
||
196 | $config->setProvider($provider); |
||
197 | |||
198 | /** @var VoipMsConfig $providerConfig */ |
||
199 | $providerConfig = $config->getProvider()->getConfig(); |
||
200 | |||
201 | $usernameQuestion = new Question('Please enter your VoIP.ms API username: '); |
||
202 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
203 | |||
204 | $passwordQuestion = new Question('Please enter your VoIP.ms API password: '); |
||
205 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
206 | |||
207 | $didQuestion = new Question('Please enter your VoIP.ms DID: '); |
||
208 | $did = $helper->ask($input, $output, $didQuestion); |
||
209 | |||
210 | $providerConfig->setUser($username); |
||
211 | $providerConfig->setPassword($password); |
||
212 | $providerConfig->setDid($did); |
||
213 | break; |
||
214 | |||
215 | case 'huawei_e3531': |
||
216 | $config->setProvider($provider); |
||
217 | /** @var HuaweiE3531Config $providerConfig */ |
||
218 | $providerConfig = $config->getProvider()->getConfig(); |
||
219 | |||
220 | $urlQuestion = new Question('Please enter the base URL of the Huawei E3531 stick: ', 'http://192.168.8.1/api'); |
||
221 | $url = $helper->ask($input, $output, $urlQuestion); |
||
222 | |||
223 | $providerConfig->setUrl($url); |
||
224 | break; |
||
225 | |||
226 | case 'spryng': |
||
227 | $config->setProvider($provider); |
||
228 | /** @var SpryngSMSConfig $providerConfig */ |
||
229 | $providerConfig = $config->getProvider()->getConfig(); |
||
230 | |||
231 | $apitokenQuestion = new Question('Please enter your Spryng api token: '); |
||
232 | $apitoken = $helper->ask($input, $output, $apitokenQuestion); |
||
233 | |||
234 | $providerConfig->setApiToken($apitoken); |
||
235 | |||
236 | break; |
||
237 | |||
238 | default: |
||
239 | $output->writeln("Invalid provider $provider"); |
||
240 | break; |
||
241 | } |
||
258 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths