| Conditions | 11 | 
| Paths | 11 | 
| Total Lines | 51 | 
| Code Lines | 29 | 
| 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  | 
            ||
| 42 | public function handle()  | 
            ||
| 43 |     { | 
            ||
| 44 |         $smsevents = Sms_event::where('date','=',Carbon::today())->get(); | 
            ||
| 45 |         $sender_id = \Utilities::getSetting('sms_sender_id'); | 
            ||
| 46 | |||
| 47 | foreach($smsevents as $smsevent)  | 
            ||
| 48 |         { | 
            ||
| 49 | $sms_text = $smsevent->message;  | 
            ||
| 50 | $sms_status = $smsevent->status;  | 
            ||
| 51 | |||
| 52 |             foreach(explode(",", $smsevent->send_to) as $sendTo) | 
            ||
| 53 |             { | 
            ||
| 54 | switch ($sendTo)  | 
            ||
| 55 |                 { | 
            ||
| 56 | case 0:  | 
            ||
| 57 |                         $recievers = Member::where('status',1)->get(); | 
            ||
| 58 | foreach ($recievers as $reciever)  | 
            ||
| 59 |                         { | 
            ||
| 60 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,$sms_status);  | 
            ||
| 61 | }  | 
            ||
| 62 | break;  | 
            ||
| 63 | |||
| 64 | case 1:  | 
            ||
| 65 |                         $recievers = Member::where('status',0)->get(); | 
            ||
| 66 | foreach ($recievers as $reciever)  | 
            ||
| 67 |                         { | 
            ||
| 68 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,$sms_status);  | 
            ||
| 69 | }  | 
            ||
| 70 | break;  | 
            ||
| 71 | |||
| 72 | case 2:  | 
            ||
| 73 |                         $recievers = Enquiry::where('status',1)->get(); | 
            ||
| 74 | foreach ($recievers as $reciever)  | 
            ||
| 75 |                         { | 
            ||
| 76 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,$sms_status);  | 
            ||
| 77 | }  | 
            ||
| 78 | |||
| 79 | break;  | 
            ||
| 80 | |||
| 81 | case 3:  | 
            ||
| 82 |                         $recievers = Enquiry::where('status',0)->get(); | 
            ||
| 83 | foreach ($recievers as $reciever)  | 
            ||
| 84 |                         { | 
            ||
| 85 | \Utilities::Sms($sender_id,$reciever->contact,$sms_text,$sms_status);  | 
            ||
| 86 | }  | 
            ||
| 87 | |||
| 88 | break;  | 
            ||
| 89 | |||
| 90 | default:  | 
            ||
| 91 | # code...  | 
            ||
| 92 | break;  | 
            ||
| 93 | }  | 
            ||
| 98 |