Conditions | 10 |
Paths | 10 |
Total Lines | 154 |
Code Lines | 107 |
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 |
||
106 | private function configureSms(InputInterface $input, OutputInterface $output) { |
||
107 | $helper = $this->getHelper('question'); |
||
108 | $providerQuestion = new Question('Please choose a SMS provider (websms, playsms, clockworksms, puzzelsms, ecallsms, voipms, huawei_e3531, messtosms, gatewayapisms): ', 'websms'); |
||
109 | $provider = $helper->ask($input, $output, $providerQuestion); |
||
110 | |||
111 | /** @var SMSConfig $config */ |
||
112 | $config = $this->smsGateway->getConfig(); |
||
113 | switch ($provider) { |
||
114 | case 'websms': |
||
115 | $config->setProvider($provider); |
||
116 | /** @var WebSmsConfig $providerConfig */ |
||
117 | $providerConfig = $config->getProvider()->getConfig(); |
||
118 | |||
119 | $usernameQuestion = new Question('Please enter your websms.de username: '); |
||
120 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
121 | $passwordQuestion = new Question('Please enter your websms.de password: '); |
||
122 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
123 | |||
124 | $providerConfig->setUser($username); |
||
125 | $providerConfig->setPassword($password); |
||
126 | |||
127 | break; |
||
128 | case 'playsms': |
||
129 | $config->setProvider($provider); |
||
130 | /** @var PlaySMSConfig $providerConfig */ |
||
131 | $providerConfig = $config->getProvider()->getConfig(); |
||
132 | |||
133 | $urlQuestion = new Question('Please enter your PlaySMS URL: '); |
||
134 | $url = $helper->ask($input, $output, $urlQuestion); |
||
135 | $usernameQuestion = new Question('Please enter your PlaySMS username: '); |
||
136 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
137 | $passwordQuestion = new Question('Please enter your PlaySMS password: '); |
||
138 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
139 | |||
140 | $providerConfig->setUrl($url); |
||
141 | $providerConfig->setUser($username); |
||
142 | $providerConfig->setPassword($password); |
||
143 | |||
144 | break; |
||
145 | case 'clockworksms': |
||
146 | $config->setProvider($provider); |
||
147 | /** @var ClockworkSMSConfig $providerConfig */ |
||
148 | $providerConfig = $config->getProvider()->getConfig(); |
||
149 | |||
150 | $apitokenQuestion = new Question('Please enter your clockworksms api token: '); |
||
151 | $apitoken = $helper->ask($input, $output, $apitokenQuestion); |
||
152 | |||
153 | $providerConfig->setApiToken($apitoken); |
||
154 | |||
155 | break; |
||
156 | case 'puzzelsms': |
||
157 | $config->setProvider($provider); |
||
158 | |||
159 | /** @var PuzzelSMSConfig $providerConfig */ |
||
160 | $providerConfig = $config->getProvider()->getConfig(); |
||
161 | |||
162 | $urlQuestion = new Question('Please enter your PuzzelSMS URL: '); |
||
163 | $url = $helper->ask($input, $output, $urlQuestion); |
||
164 | |||
165 | $usernameQuestion = new Question('Please enter your PuzzelSMS username: '); |
||
166 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
167 | |||
168 | $passwordQuestion = new Question('Please enter your PuzzelSMS password: '); |
||
169 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
170 | |||
171 | $serviceQuestion = new Question('Please enter your PuzzelSMS service ID: '); |
||
172 | $serviceId = $helper->ask($input, $output, $serviceQuestion); |
||
173 | |||
174 | $providerConfig->setUrl($url); |
||
175 | $providerConfig->setUser($username); |
||
176 | $providerConfig->setPassword($password); |
||
177 | $providerConfig->setServiceId($serviceId); |
||
178 | break; |
||
179 | case 'ecallsms': |
||
180 | $config->setProvider($provider); |
||
181 | /** @var EcallSMSConfig $providerConfig */ |
||
182 | $providerConfig = $config->getProvider()->getConfig(); |
||
183 | |||
184 | $usernameQuestion = new Question('Please enter your eCall.ch username: '); |
||
185 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
186 | $passwordQuestion = new Question('Please enter your eCall.ch password: '); |
||
187 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
188 | $senderIdQuestion = new Question('Please enter your eCall.ch sender ID: '); |
||
189 | $senderId = $helper->ask($input, $output, $senderIdQuestion); |
||
190 | |||
191 | $providerConfig->setUser($username); |
||
192 | $providerConfig->setPassword($password); |
||
193 | $providerConfig->setSenderId($senderId); |
||
194 | break; |
||
195 | |||
196 | case 'voipms': |
||
197 | $config->setProvider($provider); |
||
198 | |||
199 | /** @var VoipMsConfig $providerConfig */ |
||
200 | $providerConfig = $config->getProvider()->getConfig(); |
||
201 | |||
202 | $usernameQuestion = new Question('Please enter your VoIP.ms API username: '); |
||
203 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
204 | |||
205 | $passwordQuestion = new Question('Please enter your VoIP.ms API password: '); |
||
206 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
207 | |||
208 | $didQuestion = new Question('Please enter your VoIP.ms DID: '); |
||
209 | $did = $helper->ask($input, $output, $didQuestion); |
||
210 | |||
211 | $providerConfig->setUser($username); |
||
212 | $providerConfig->setPassword($password); |
||
213 | $providerConfig->setDid($did); |
||
214 | break; |
||
215 | |||
216 | case 'huawei_e3531': |
||
217 | $config->setProvider($provider); |
||
218 | /** @var HuaweiE3531Config $providerConfig */ |
||
219 | $providerConfig = $config->getProvider()->getConfig(); |
||
220 | |||
221 | $urlQuestion = new Question('Please enter the base URL of the Huawei E3531 stick: ', 'http://192.168.8.1/api'); |
||
222 | $url = $helper->ask($input, $output, $urlQuestion); |
||
223 | |||
224 | $providerConfig->setUrl($url); |
||
225 | break; |
||
226 | |||
227 | case 'messtosms': |
||
228 | $config->setProvider($provider); |
||
229 | /** @var MesstoSmsConfig $providerConfig */ |
||
230 | $providerConfig = $config->getProvider()->getConfig(); |
||
231 | |||
232 | $usernameQuestion = new Question('Please enter your messto.com username: '); |
||
233 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
234 | $passwordQuestion = new Question('Please enter your messto.com password: '); |
||
235 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
236 | |||
237 | $providerConfig->setUser($username); |
||
238 | $providerConfig->setPassword($password); |
||
239 | |||
240 | break; |
||
241 | |||
242 | case 'gatewayapisms': |
||
243 | $config->setProvider($provider); |
||
244 | /** @var GatewayApiSmsConfig $providerConfig */ |
||
245 | $providerConfig = $config->getProvider()->getConfig(); |
||
246 | |||
247 | $authtokenQuestion = new Question('Please enter your GatewayAPI authentication token: '); |
||
248 | $authtoken = $helper->ask($input, $output, $authtokenQuestion); |
||
249 | $senderidQuestion = new Question('Please enter your GatewayAPI sender id (11 alphanumeric characters, or 15 digits): '); |
||
250 | $senderid = $helper->ask($input, $output, $senderidQuestion); |
||
251 | |||
252 | $providerConfig->setAuthToken($authtoken); |
||
253 | $providerConfig->setSenderId($senderid); |
||
254 | |||
255 | break; |
||
256 | |||
257 | default: |
||
258 | $output->writeln("Invalid provider $provider"); |
||
259 | break; |
||
260 | } |
||
277 |
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