RunCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 1
1
<?php
2
3
namespace EricMakesStuff\ServerMonitor\Commands;
4
5
use EricMakesStuff\ServerMonitor\Monitors\BaseMonitor;
6
use EricMakesStuff\ServerMonitor\Monitors\ServerMonitorFactory;
7
8
class RunCommand extends BaseCommand
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $signature = 'monitor:run {monitor? : Comma-delimited list of names of specific monitors to run}';
14
15
    /**
16
     * @var string
17
     */
18
    protected $description = 'Run all server monitor tasks.';
19
20
    public function handle()
21
    {
22
        $monitors = ServerMonitorFactory::createForMonitorConfig(
23
            config('server-monitor.monitors'),
24
            explode(',', $this->argument('monitor'))
25
        );
26
27
        $monitors->each(function (BaseMonitor $monitor) {
28
            $monitor->runMonitor();
29
        });
30
    }
31
}
32