@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | protected $exception; |
10 | 10 | protected $exceptionContext; |
11 | 11 | |
12 | - public function __construct($exception, array $exceptionContext = []) |
|
12 | + public function __construct($exception, array $exceptionContext = [ ]) |
|
13 | 13 | { |
14 | 14 | $this->exception = $exception; |
15 | 15 | $this->exceptionContext = $exceptionContext; |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | 'icon_emoji' => config('laravel_alert_notifications.slack.emoji'), |
24 | 24 | 'attachments' => [ |
25 | 25 | [ |
26 | - 'text' => '*Environment:* '.config('app.env') |
|
27 | - .' '.config('laravel_alert_notifications.slack.subject') |
|
28 | - .'\n'.'Server: '.Request::server('SERVER_NAME') |
|
29 | - .'\n'.'Request Url: '.Request::fullUrl() |
|
30 | - .'\n'.'Message: '.$this->exception->getMessage() |
|
31 | - .'\n'.'Exception: '.get_class($this->exception) |
|
32 | - .'\n'.'Exception Code: '.$this->exception->getCode() |
|
33 | - .'\n'.'In File: *'.$this->exception->getFile().'* on line '.$this->exception->getLine() |
|
34 | - .'\n'.'Context: '.'```\$context = '.var_export($this->exceptionContext, true).';```' |
|
35 | - .'\n'.'Stack Trace: '.'```'.$this->exception->getTraceAsString().'```', 'mrkdwn' => true, |
|
26 | + 'text' => '*Environment:* ' . config('app.env') |
|
27 | + .' ' . config('laravel_alert_notifications.slack.subject') |
|
28 | + .'\n' . 'Server: ' . Request::server('SERVER_NAME') |
|
29 | + .'\n' . 'Request Url: ' . Request::fullUrl() |
|
30 | + .'\n' . 'Message: ' . $this->exception->getMessage() |
|
31 | + .'\n' . 'Exception: ' . get_class($this->exception) |
|
32 | + .'\n' . 'Exception Code: ' . $this->exception->getCode() |
|
33 | + .'\n' . 'In File: *' . $this->exception->getFile() . '* on line ' . $this->exception->getLine() |
|
34 | + .'\n' . 'Context: ' . '```\$context = ' . var_export($this->exceptionContext, true) . ';```' |
|
35 | + .'\n' . 'Stack Trace: ' . '```' . $this->exception->getTraceAsString() . '```', 'mrkdwn' => true, |
|
36 | 36 | ], |
37 | 37 | ], |
38 | 38 | ]; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | protected $exception; |
10 | 10 | protected $exceptionContext; |
11 | 11 | |
12 | - public function __construct($exception, array $exceptionContext = []) |
|
12 | + public function __construct($exception, array $exceptionContext = [ ]) |
|
13 | 13 | { |
14 | 14 | $this->exception = $exception; |
15 | 15 | $this->exceptionContext = $exceptionContext; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'sections' => [ |
27 | 27 | [ |
28 | 28 | 'activityTitle' => config('laravel_alert_notifications.microsoft_teams.cardSubject'), |
29 | - 'activitySubtitle' => 'Error has occurred on '.config('app.name').' - '.config('app.name'), |
|
29 | + 'activitySubtitle' => 'Error has occurred on ' . config('app.name') . ' - ' . config('app.name'), |
|
30 | 30 | 'activityImage' => '', |
31 | 31 | 'facts' => [ |
32 | 32 | [ |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | 'name' => 'In File:', |
58 | 58 | 'value' => '<b style="color:red;">' |
59 | 59 | .$this->exception->getFile() |
60 | - .' on line '.$this->exception->getLine().'</b>', |
|
60 | + .' on line ' . $this->exception->getLine() . '</b>', |
|
61 | 61 | ], |
62 | 62 | [ |
63 | 63 | 'name' => 'Stack Trace:', |
64 | - 'value' => '<pre>'.$this->exception->getTraceAsString().'</pre>', |
|
64 | + 'value' => '<pre>' . $this->exception->getTraceAsString() . '</pre>', |
|
65 | 65 | ], |
66 | 66 | [ |
67 | 67 | 'name' => 'Context:', |
68 | - 'value' => '<pre>$context = '.var_export($this->exceptionContext, true).';</pre>', |
|
68 | + 'value' => '<pre>$context = ' . var_export($this->exceptionContext, true) . ';</pre>', |
|
69 | 69 | ], |
70 | 70 | ], |
71 | 71 | ], |
@@ -6,49 +6,49 @@ |
||
6 | 6 | 'cache_driver' => env('ALERT_NOTIFICATION_CACHE_DRIVER', 'file'), |
7 | 7 | 'cache_prefix' => env('ALERT_NOTIFICATION_CACHE_PREFIX', 'laravel-alert-notifications'), |
8 | 8 | 'default_notification_level' => 'error', |
9 | - 'exclude_notification_levels' => ['debug', 'info'], |
|
9 | + 'exclude_notification_levels' => [ 'debug', 'info' ], |
|
10 | 10 | 'mail' => [ |
11 | 11 | 'enabled' => true, |
12 | 12 | 'toAddress' => env('ALERT_NOTIFICATION_MAIL_TO_ADDRESS'), |
13 | 13 | 'fromAddress' => env('ALERT_NOTIFICATION_MAIL_FROM_ADDRESS'), |
14 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
14 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
15 | 15 | 'notice' => [ |
16 | 16 | 'toAddress' => env('ALERT_NOTIFICATION_MAIL_NOTICE_TO_ADDRESS'), |
17 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
17 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
18 | 18 | ], |
19 | 19 | 'warning' => [ |
20 | 20 | 'toAddress' => env('ALERT_NOTIFICATION_MAIL_WARNING_TO_ADDRESS'), |
21 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
21 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
22 | 22 | ], |
23 | 23 | 'error' => [ |
24 | 24 | 'toAddress' => env('ALERT_NOTIFICATION_MAIL_ERROR_TO_ADDRESS'), |
25 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
25 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
26 | 26 | ], |
27 | 27 | 'critical' => [ |
28 | 28 | 'toAddress' => env('ALERT_NOTIFICATION_MAIL_CRITICAL_TO_ADDRESS'), |
29 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
29 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
30 | 30 | ], |
31 | 31 | 'alert' => [ |
32 | 32 | 'toAddress' => env('ALERT_NOTIFICATION_MAIL_ALERT_TO_ADDRESS'), |
33 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
33 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
34 | 34 | ], |
35 | 35 | 'emergency' => [ |
36 | 36 | 'toAddress' => env('ALERT_NOTIFICATION_MAIL_EMERGENCY_TO_ADDRESS'), |
37 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
37 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
38 | 38 | ], |
39 | 39 | ], |
40 | 40 | 'microsoft_teams' => [ |
41 | 41 | 'enabled' => true, |
42 | 42 | 'proxy' => env('ALERT_NOTIFICATION_CURL_PROXY', null), |
43 | 43 | 'themeColor' => 'ff5864', |
44 | - 'cardSubject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
44 | + 'cardSubject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
45 | 45 | 'webhook' => env('ALERT_NOTIFICATION_MICROSOFT_TEAMS_WEBHOOK'), |
46 | 46 | ], |
47 | 47 | 'slack' => [ |
48 | 48 | 'enabled' => true, |
49 | 49 | 'proxy' => env('ALERT_NOTIFICATION_CURL_PROXY', null), |
50 | - 'subject' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
51 | - 'username' => '['.env('APP_ENV').'] ['.trim(`hostname`).'] '.env('APP_NAME'), |
|
50 | + 'subject' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
51 | + 'username' => '[' . env('APP_ENV') . '] [' . trim(`hostname`) . '] ' . env('APP_NAME'), |
|
52 | 52 | 'emoji' => ':slack:', |
53 | 53 | 'webhook' => env('ALERT_NOTIFICATION_SLACK_WEBHOOK', null), |
54 | 54 | 'channel' => env('ALERT_NOTIFICATION_SLACK_CHANNEL', null), |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | protected $notificationLevel; |
20 | 20 | |
21 | - public function __construct($exception, string $notificationLevel, array $exceptionContext = []) |
|
21 | + public function __construct($exception, string $notificationLevel, array $exceptionContext = [ ]) |
|
22 | 22 | { |
23 | 23 | $this->exception = $exception; |
24 | 24 | $this->exceptionContext = $exceptionContext; |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | |
28 | 28 | public function build() |
29 | 29 | { |
30 | - $configPrefix = 'laravel_alert_notifications.mail.'.$this->notificationLevel.'.'; |
|
30 | + $configPrefix = 'laravel_alert_notifications.mail.' . $this->notificationLevel . '.'; |
|
31 | 31 | |
32 | 32 | $from = config('laravel_alert_notifications.mail.fromAddress'); |
33 | - $to = config($configPrefix.'toAddress') ?? config('laravel_alert_notifications.mail.toAddress'); |
|
34 | - $subject = config($configPrefix.'subject') ?? config('laravel_alert_notifications.mail.subject'); |
|
33 | + $to = config($configPrefix . 'toAddress') ?? config('laravel_alert_notifications.mail.toAddress'); |
|
34 | + $subject = config($configPrefix . 'subject') ?? config('laravel_alert_notifications.mail.subject'); |
|
35 | 35 | $subject = $this->replaceSubjectPlaceholders($subject); |
36 | 36 | |
37 | 37 | $data = [ |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | class AlertNotificationsServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - const CONFIG_PATH = __DIR__.'/config/laravel_alert_notifications.php'; |
|
9 | + const CONFIG_PATH = __DIR__ . '/config/laravel_alert_notifications.php'; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Indicates if loading of the provider is deferred. |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function boot() |
22 | 22 | { |
23 | - $this->loadViewsFrom(__DIR__.'/views', 'laravel_alert_notifications'); |
|
23 | + $this->loadViewsFrom(__DIR__ . '/views', 'laravel_alert_notifications'); |
|
24 | 24 | |
25 | 25 | $this->publishes([ |
26 | 26 | self::CONFIG_PATH => base_path('config/laravel_alert_notifications.php'), |
27 | 27 | ], 'config'); |
28 | 28 | $this->publishes([ |
29 | - __DIR__.'/views' => resource_path('views/vendor/laravel_alert_notifications'), |
|
29 | + __DIR__ . '/views' => resource_path('views/vendor/laravel_alert_notifications'), |
|
30 | 30 | ], 'views'); |
31 | 31 | |
32 | 32 | if (app() instanceof \Laravel\Lumen\Application) { |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | public function __construct( |
21 | 21 | Throwable $exception, |
22 | - array $dontAlertExceptions = [], |
|
23 | - array $notificationLevelsMapping = [], |
|
24 | - array $exceptionContext = [] |
|
22 | + array $dontAlertExceptions = [ ], |
|
23 | + array $notificationLevelsMapping = [ ], |
|
24 | + array $exceptionContext = [ ] |
|
25 | 25 | ) { |
26 | 26 | $this->exception = $exception; |
27 | 27 | $this->exceptionContext = $exceptionContext; |
28 | 28 | $this->dontAlertExceptions = $dontAlertExceptions; |
29 | - $this->notificationLevel = $notificationLevelsMapping[get_class($exception)] |
|
29 | + $this->notificationLevel = $notificationLevelsMapping[ get_class($exception) ] |
|
30 | 30 | ?? config('laravel_alert_notifications.default_notification_level'); |
31 | 31 | } |
32 | 32 | |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | |
42 | 42 | protected function shouldAlert() |
43 | 43 | { |
44 | - $levelsNotToNotify = config('laravel_alert_notifications.exclude_notification_levels') ?? []; |
|
44 | + $levelsNotToNotify = config('laravel_alert_notifications.exclude_notification_levels') ?? [ ]; |
|
45 | 45 | if ($this->isDonotAlertException() || in_array($this->notificationLevel, $levelsNotToNotify)) { |
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - if (! config('laravel_alert_notifications.throttle_enabled')) { |
|
49 | + if ( ! config('laravel_alert_notifications.throttle_enabled')) { |
|
50 | 50 | return true; |
51 | 51 | } |
52 | 52 |