1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace VojtaSvoboda\ErrorLogger\Models; |
4
|
|
|
|
5
|
|
|
use October\Rain\Database\Model; |
6
|
|
|
use October\Rain\Database\Traits\Validation as ValidationTrait; |
7
|
|
|
|
8
|
|
|
class Settings extends Model |
9
|
|
|
{ |
10
|
|
|
use ValidationTrait; |
11
|
|
|
|
12
|
|
|
public $implement = ['System.Behaviors.SettingsModel']; |
13
|
|
|
|
14
|
|
|
// A unique code |
15
|
|
|
public $settingsCode = 'vojtasvoboda_errorlogger_settings'; |
16
|
|
|
|
17
|
|
|
// Reference to field configuration |
18
|
|
|
public $settingsFields = 'fields.yaml'; |
19
|
|
|
|
20
|
|
|
public $rules = [ |
21
|
|
|
// 'nativemailer_email' => 'email', |
|
|
|
|
22
|
|
|
]; |
23
|
|
|
|
24
|
|
|
public $attributeNames = [ |
25
|
|
|
'nativemailer_email' => "Developer's email", |
26
|
|
|
'swiftmailer_email' => "Developer's email", |
27
|
|
|
]; |
28
|
|
|
|
29
|
|
|
public static function getNativemailerLevelOptions() |
30
|
|
|
{ |
31
|
|
|
return self::getErrorLevelOptions(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public static function getSwiftmailerLevelOptions() |
35
|
|
|
{ |
36
|
|
|
return self::getErrorLevelOptions(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public static function getSlackLevelOptions() |
40
|
|
|
{ |
41
|
|
|
return self::getErrorLevelOptions(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public static function getSyslogLevelOptions() |
45
|
|
|
{ |
46
|
|
|
return self::getErrorLevelOptions(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public static function getNewrelicLevelOptions() |
50
|
|
|
{ |
51
|
|
|
return self::getErrorLevelOptions(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public static function getErrorLevelOptions() |
55
|
|
|
{ |
56
|
|
|
return [ |
57
|
|
|
100 => 'Debug - Level 100 - Detailed debug information', |
58
|
|
|
200 => 'Info - Level 200 - Interesting events e.g. user logs in, SQL logs', |
59
|
|
|
250 => 'Notice - Level 250 - Uncommon events', |
60
|
|
|
300 => 'Warning - Level 300 - Exceptional occurrences that are not errors', |
61
|
|
|
400 => 'Error - Level 400 - Runtime errors', |
62
|
|
|
500 => 'Critical - Level 500 - Critical conditions', |
63
|
|
|
550 => 'Alert - Level 550 - Action must be taken immediately', |
64
|
|
|
600 => 'Emergency - Level 600 - Urgent alert' |
65
|
|
|
]; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.