Completed
Pull Request — master (#65)
by
unknown
03:02 queued 52s
created

ExcludedErrors::hasExcludedError()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 1
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
}