| Conditions | 14 |
| Paths | 12 |
| Total Lines | 64 |
| Code Lines | 35 |
| 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 |
||
| 107 | public function shoot(Request $request) |
||
| 108 | { |
||
| 109 | $sms_text = $request->message; |
||
| 110 | $sender_id = $request->sender_id; |
||
| 111 | |||
| 112 | foreach($request->send as $sendnow) |
||
| 113 | { |
||
| 114 | switch ($sendnow) { |
||
| 115 | case 0: |
||
| 116 | $recievers = Member::where('status',1)->get(); |
||
| 117 | foreach ($recievers as $reciever) |
||
| 118 | { |
||
| 119 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,true); |
||
| 120 | } |
||
| 121 | break; |
||
| 122 | |||
| 123 | case 1: |
||
| 124 | $recievers = Member::where('status',0)->get(); |
||
| 125 | foreach ($recievers as $reciever) |
||
| 126 | { |
||
| 127 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,true); |
||
| 128 | } |
||
| 129 | break; |
||
| 130 | |||
| 131 | case 2: |
||
| 132 | $recievers = Enquiry::where('status',1)->get(); |
||
| 133 | foreach ($recievers as $reciever) |
||
| 134 | { |
||
| 135 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,true); |
||
| 136 | } |
||
| 137 | |||
| 138 | break; |
||
| 139 | |||
| 140 | case 3: |
||
| 141 | $recievers = Enquiry::where('status',0)->get(); |
||
| 142 | foreach ($recievers as $reciever) |
||
| 143 | { |
||
| 144 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,true); |
||
| 145 | } |
||
| 146 | |||
| 147 | break; |
||
| 148 | |||
| 149 | case 4: |
||
| 150 | if($request->customcontacts != '') |
||
| 151 | { |
||
| 152 | $custom = explode(",",str_replace(" ","",($request->customcontacts))); |
||
| 153 | foreach($custom as $number) |
||
| 154 | { |
||
| 155 | if (starts_with($number,'0')) |
||
| 156 | { |
||
| 157 | $number = substr($number, 1); |
||
| 158 | } |
||
| 159 | \Utilities::Sms($sender_id,$number,$sms_text,true); |
||
| 160 | } |
||
| 161 | } |
||
| 162 | |||
| 163 | default: |
||
| 164 | # code... |
||
| 165 | break; |
||
| 166 | } |
||
| 167 | } |
||
| 168 | |||
| 169 | flash()->success('Message has been successfully sent'); |
||
| 170 | return redirect('sms/send'); |
||
| 171 | } |
||
| 187 | } |
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