Passed
Push — master ( 0db7f5...3c2912 )
by Ben
74:34 queued 68:06
created

Monitor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A check() 0 10 3
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Thinktomorrow\Chief\HealthMonitor;
6
7
use Thinktomorrow\Chief\HealthMonitor\Checks\HomepageCheck;
8
use Thinktomorrow\Chief\HealthMonitor\Notifiers\AlertBarNotifier;
9
10
class Monitor
11
{
12
    private static $checks = [
13
        HomepageCheck::class => AlertBarNotifier::class
14
    ];
15
16
    public static function check()
17
    {
18
        foreach(static::$checks as $check => $notifier)
0 ignored issues
show
Bug introduced by
Since $checks is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $checks to at least protected.
Loading history...
19
        {
20
            $checker = (new $check);
21
            $notifier = (new $notifier);
22
            
23
            if(!$checker->check())
24
            {
25
                return $notifier->notify($checker->notify());
26
            }
27
        } 
28
    }
29
}
30