@@ -7,33 +7,33 @@ |
||
7 | 7 | |
8 | 8 | class ExceptionListener |
9 | 9 | { |
10 | - private $paramter; |
|
10 | + private $paramter; |
|
11 | 11 | |
12 | - public function __construct(ParameterBagInterface $parameterBag) |
|
13 | - { |
|
14 | - $this->paramter = $parameterBag; |
|
15 | - } |
|
12 | + public function __construct(ParameterBagInterface $parameterBag) |
|
13 | + { |
|
14 | + $this->paramter = $parameterBag; |
|
15 | + } |
|
16 | 16 | |
17 | - public function onKernelException(ExceptionEvent $event) |
|
18 | - { |
|
19 | - $slack_webhook = $this->paramter->get('ribs_admin.slack_webhook'); |
|
20 | - if ($slack_webhook) { |
|
21 | - $data = array(); |
|
22 | - $data['channel'] = '#errors'; |
|
23 | - $data['username'] = $_SERVER['HTTP_HOST']; |
|
24 | - $data['text'] = "• *Erreur* : " . strip_tags($event->getThrowable()->getMessage()); |
|
25 | - $data['text'] .= "\n• *Erreur File* : " . strip_tags($event->getThrowable()->getFile()) . " at line :" . strip_tags($event->getThrowable()->getLine()); |
|
26 | - $data['unfurl_links'] = false; |
|
27 | - $data_json = json_encode($data); |
|
17 | + public function onKernelException(ExceptionEvent $event) |
|
18 | + { |
|
19 | + $slack_webhook = $this->paramter->get('ribs_admin.slack_webhook'); |
|
20 | + if ($slack_webhook) { |
|
21 | + $data = array(); |
|
22 | + $data['channel'] = '#errors'; |
|
23 | + $data['username'] = $_SERVER['HTTP_HOST']; |
|
24 | + $data['text'] = "• *Erreur* : " . strip_tags($event->getThrowable()->getMessage()); |
|
25 | + $data['text'] .= "\n• *Erreur File* : " . strip_tags($event->getThrowable()->getFile()) . " at line :" . strip_tags($event->getThrowable()->getLine()); |
|
26 | + $data['unfurl_links'] = false; |
|
27 | + $data_json = json_encode($data); |
|
28 | 28 | |
29 | - $ch = curl_init(); |
|
30 | - curl_setopt($ch, CURLOPT_URL, $slack_webhook); |
|
31 | - curl_setopt($ch, CURLOPT_POST, 1); |
|
32 | - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json))); |
|
33 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json); |
|
34 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
35 | - curl_exec($ch); |
|
36 | - curl_close($ch); |
|
37 | - } |
|
38 | - } |
|
29 | + $ch = curl_init(); |
|
30 | + curl_setopt($ch, CURLOPT_URL, $slack_webhook); |
|
31 | + curl_setopt($ch, CURLOPT_POST, 1); |
|
32 | + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json))); |
|
33 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json); |
|
34 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
35 | + curl_exec($ch); |
|
36 | + curl_close($ch); |
|
37 | + } |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $ch = curl_init(); |
30 | 30 | curl_setopt($ch, CURLOPT_URL, $slack_webhook); |
31 | 31 | curl_setopt($ch, CURLOPT_POST, 1); |
32 | - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json))); |
|
32 | + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_json))); |
|
33 | 33 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json); |
34 | 34 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
35 | 35 | curl_exec($ch); |