CheckPingLastUpdate   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 50
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 20 3
1
<?php
2
3
namespace App\Console\Commands;
4
5
use App\Ping;
6
use Illuminate\Console\Command;
7
8
class CheckPingLastUpdate extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'pings:update-overdue';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Command description';
23
24
    /**
25
     * Create a new command instance.
26
     */
27
    public function __construct()
28
    {
29
        parent::__construct();
30
    }
31
32
    /**
33
     * Execute the console command.
34
     *
35
     * @return mixed
36
     */
37
    public function handle()
38
    {
39
        $results = [];
40
41
        $pings = Ping::active()->get();
0 ignored issues
show
Bug introduced by
The method active() does not exist on App\Ping. Did you maybe mean scopeActive()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
42
        foreach ($pings as $ping) {
43
            /** @var Ping $ping */
44
45
            $results[] = [$ping->error, $ping->name, $ping->last_ping, $ping->frequency_value . ' ' . $ping->frequency, $ping->overdueDate, $ping->overdue];
46
47
            if ($ping->overdue) {
48
                $ping->setError();
49
            } else {
50
                $ping->clearError();
51
            }
52
53
        }
54
55
        $this->table(['error', 'name', 'last_ping', 'frequency', 'overdue_date', 'overdue'], $results);
56
    }
57
}
58