Completed
Pull Request — master (#65)
by
unknown
06:19
created

ExcludedErrors   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExcludedErrors() 0 6 1
A hasExcludedError() 0 17 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: dd
5
 * Date: 18.06.2018
6
 * Time: 02:52
7
 */
8
9
namespace Spatie\ServerMonitor\Excluded;
10
11
12
use Illuminate\Support\Facades\Config;
13
use phpDocumentor\Reflection\Types\Boolean;
14
15
class ExcludedErrors
16
{
17
18
19
20
    public static function getExcludedErrors() : array
21
    {
22
23
        return Config::get("server-monitor.excluded_errors",[]);
24
25
    }
26
27
28
    public static function hasExcludedError(String $errorString) : Bool
29
    {
30
31
        $excludedErrors = self::getExcludedErrors();
32
33
34
35
        foreach ($excludedErrors as $excludedError)
36
        {
37
            $counter=0;
38
            str_replace($excludedError,"_REPLACE_",$errorString,$counter);
39
            if($counter>0) return true;
40
        }
41
42
        return false;
43
44
    }
45
46
47
}