Conditions | 5 |
Paths | 5 |
Total Lines | 77 |
Code Lines | 54 |
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 |
||
101 | private function configureSms(InputInterface $input, OutputInterface $output) { |
||
102 | $helper = $this->getHelper('question'); |
||
103 | $providerQuestion = new Question('Please choose a SMS provider (websms, playsms, clockworksms, puzzelsms): ', 'websms'); |
||
104 | $provider = $helper->ask($input, $output, $providerQuestion); |
||
105 | |||
106 | /** @var SMSConfig $config */ |
||
107 | $config = $this->smsGateway->getConfig(); |
||
108 | switch ($provider) { |
||
109 | case 'websms': |
||
110 | $config->setProvider($provider); |
||
111 | /** @var WebSmsConfig $providerConfig */ |
||
112 | $providerConfig = $config->getProvider()->getConfig(); |
||
113 | |||
114 | $usernameQuestion = new Question('Please enter your websms.de username: '); |
||
115 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
116 | $passwordQuestion = new Question('Please enter your websms.de password: '); |
||
117 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
118 | |||
119 | $providerConfig->setUser($username); |
||
120 | $providerConfig->setPassword($password); |
||
121 | |||
122 | break; |
||
123 | case 'playsms': |
||
124 | $config->setProvider($provider); |
||
125 | /** @var PlaySMSConfig $providerConfig */ |
||
126 | $providerConfig = $config->getProvider()->getConfig(); |
||
127 | |||
128 | $urlQuestion = new Question('Please enter your PlaySMS URL: '); |
||
129 | $url = $helper->ask($input, $output, $urlQuestion); |
||
130 | $usernameQuestion = new Question('Please enter your PlaySMS username: '); |
||
131 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
132 | $passwordQuestion = new Question('Please enter your PlaySMS password: '); |
||
133 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
134 | |||
135 | $providerConfig->setUrl($url); |
||
136 | $providerConfig->setUser($username); |
||
137 | $providerConfig->setPassword($password); |
||
138 | |||
139 | break; |
||
140 | case 'clockworksms': |
||
141 | $config->setProvider($provider); |
||
142 | /** @var ClockworkSmsConfig $providerConfig */ |
||
143 | $providerConfig = $config->getProvider()->getConfig(); |
||
144 | |||
145 | $apitokenQuestion = new Question('Please enter your clockworksms api token: '); |
||
146 | $apitoken = $helper->ask($input, $output, $apitokenQuestion); |
||
147 | |||
148 | $providerConfig->setApiToken($apitoken); |
||
149 | |||
150 | break; |
||
151 | case 'puzzelsms': |
||
152 | $config->setProvider($provider); |
||
153 | |||
154 | /** @var PuzzelSMSConfig $providerConfig */ |
||
155 | $providerConfig = $config->getProvider()->getConfig(); |
||
156 | |||
157 | $urlQuestion = new Question('Please enter your PuzzelSMS URL: '); |
||
158 | $url = $helper->ask($input, $output, $urlQuestion); |
||
159 | |||
160 | $usernameQuestion = new Question('Please enter your PuzzelSMS username: '); |
||
161 | $username = $helper->ask($input, $output, $usernameQuestion); |
||
162 | |||
163 | $passwordQuestion = new Question('Please enter your PuzzelSMS password: '); |
||
164 | $password = $helper->ask($input, $output, $passwordQuestion); |
||
165 | |||
166 | $serviceQuestion = new Question('Please enter your PuzzelSMS service ID: '); |
||
167 | $serviceId = $helper->ask($input, $output, $serviceQuestion); |
||
168 | |||
169 | $providerConfig->setUrl($url); |
||
170 | $providerConfig->setUser($username); |
||
171 | $providerConfig->setPassword($password); |
||
172 | $providerConfig->setServiceId($serviceId); |
||
173 | break; |
||
174 | |||
175 | default: |
||
176 | $output->writeln("Invalid provider $provider"); |
||
177 | break; |
||
178 | } |
||
194 | } |
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