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