ReshootOfflineSms   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 46
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 15 3
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Carbon\Carbon;
7
use App\Sms_log;
8
9
class ReshootOfflineSms extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'reshoot:offlineSms';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Reshoots all the offline sms ever hour';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @return void
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40
    public function handle()
41
    {
42
        try
43
        {
44
            $logs = Sms_log::where('status','=','offline')->get();
45
46
            foreach($logs as $log)
47
            {
48
                $text = urldecode($log->message);
49
                $sender_id = $log->sender_id;
50
                \Utilities::retrySms($sender_id,$log->number,$text,$log);
51
            }
52
        }        
53
        catch(\Exception $e)
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
54
        {
55
56
        }
57
58
    }
59
}
60