@@ -120,6 +120,9 @@ |
||
120 | 120 | return $data; |
121 | 121 | } // end getExceptionData |
122 | 122 | |
123 | + /** |
|
124 | + * @param SplFileObject $file |
|
125 | + */ |
|
123 | 126 | private function getLineInfo($file, $line, $i) |
124 | 127 | { |
125 | 128 | $currentLine = $line + $i; |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Exception; |
6 | 6 | use SplFileObject; |
7 | 7 | use Illuminate\Support\Facades\Log; |
8 | -use Illuminate\Support\Facades\Mail; |
|
9 | 8 | use Illuminate\Support\Facades\Request; |
10 | 9 | use Illuminate\Support\Facades\Session; |
11 | 10 | use Yaro\LogEnvelope\Drivers\DriverFactory; |
@@ -105,7 +105,7 @@ |
||
105 | 105 | $file = new SplFileObject($data['file']); |
106 | 106 | for ($i = -1 * abs($count); $i <= abs($count); $i++) { |
107 | 107 | list($line, $exegutorLine) = $this->getLineInfo($file, $data['line'], $i); |
108 | - $data['exegutor'][] = $exegutorLine; |
|
108 | + $data['exegutor'][] = $exegutorLine; |
|
109 | 109 | $data['file_lines'][$data['line'] + $i] = $line; |
110 | 110 | } |
111 | 111 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | protected function prepare() |
11 | 11 | { |
12 | 12 | $this->config['from_name'] = $this->config['from_name'] ?: 'Log Envelope'; |
13 | - $this->config['from_email'] = $this->config['from_email'] ?: 'logenvelope@'. $this->data['host']; |
|
13 | + $this->config['from_email'] = $this->config['from_email'] ?: 'logenvelope@' . $this->data['host']; |
|
14 | 14 | } // end prepare |
15 | 15 | |
16 | 16 | protected function check() |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $data = $this->data; |
28 | 28 | $config = $this->config; |
29 | 29 | |
30 | - MailFacade::queue('log-envelope::main', $data, function ($message) use ($data, $config) { |
|
30 | + MailFacade::queue('log-envelope::main', $data, function($message) use ($data, $config) { |
|
31 | 31 | $subject = sprintf('[%s] @ %s: %s', $data['class'], $data['host'], $data['exception']); |
32 | 32 | |
33 | 33 | // to protect from gmail's anchors automatic generating |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | foreach ($this->config['chats'] as $idUser) { |
43 | 43 | $url = 'https://api.telegram.org/'. $this->config['token'] .'/sendMessage?disable_web_page_preview=true&chat_id='. $idUser |
44 | - . '&parse_mode=HTML&text='; |
|
44 | + . '&parse_mode=HTML&text='; |
|
45 | 45 | |
46 | 46 | @file_get_contents($url . $text); |
47 | 47 | } |
@@ -35,12 +35,12 @@ |
||
35 | 35 | $biggestNumberLength = strlen(max(array_keys($data['file_lines']))); |
36 | 36 | foreach ($data['file_lines'] as $num => $line) { |
37 | 37 | $num = str_pad($num, $biggestNumberLength, ' ', STR_PAD_LEFT); |
38 | - $num = '<code>'. $num .'</code>'; |
|
39 | - $text .= urlencode($num .'|<code>'. htmlentities($line) .'</code>'); |
|
38 | + $num = '<code>' . $num . '</code>'; |
|
39 | + $text .= urlencode($num . '|<code>' . htmlentities($line) . '</code>'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | foreach ($this->config['chats'] as $idUser) { |
43 | - $url = 'https://api.telegram.org/'. $this->config['token'] .'/sendMessage?disable_web_page_preview=true&chat_id='. $idUser |
|
43 | + $url = 'https://api.telegram.org/' . $this->config['token'] . '/sendMessage?disable_web_page_preview=true&chat_id=' . $idUser |
|
44 | 44 | . '&parse_mode=HTML&text='; |
45 | 45 | |
46 | 46 | @file_get_contents($url . $text); |
@@ -48,11 +48,11 @@ |
||
48 | 48 | |
49 | 49 | |
50 | 50 | $url = 'https://slack.com/api/chat.postMessage?' |
51 | - . 'token='. $this->config['token'] |
|
52 | - . '&channel='. urlencode($this->config['channel']) |
|
53 | - . '&text='. urlencode($text) |
|
54 | - . '&username='. urlencode($this->config['username']) |
|
55 | - . '&as_user=false&icon_url=http%3A%2F%2Fcherry-pie.co%2Fimg%2Flog-envelope.png&mrkdwn=1&pretty=1&attachments='. urlencode(json_encode([$attachments])); |
|
51 | + . 'token='. $this->config['token'] |
|
52 | + . '&channel='. urlencode($this->config['channel']) |
|
53 | + . '&text='. urlencode($text) |
|
54 | + . '&username='. urlencode($this->config['username']) |
|
55 | + . '&as_user=false&icon_url=http%3A%2F%2Fcherry-pie.co%2Fimg%2Flog-envelope.png&mrkdwn=1&pretty=1&attachments='. urlencode(json_encode([$attachments])); |
|
56 | 56 | |
57 | 57 | @file_get_contents($url); |
58 | 58 | } // end send |
@@ -43,16 +43,16 @@ |
||
43 | 43 | $line = preg_replace('~[\r\n]~', '', $line); |
44 | 44 | // double spaces, so in slack it'll be more readable |
45 | 45 | $line = preg_replace('~(\s+)~', "$1$1", $line); |
46 | - $attachments['text'] .= $num .'| '. $line ."\n"; |
|
46 | + $attachments['text'] .= $num . '| ' . $line . "\n"; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | $url = 'https://slack.com/api/chat.postMessage?' |
51 | - . 'token='. $this->config['token'] |
|
52 | - . '&channel='. urlencode($this->config['channel']) |
|
53 | - . '&text='. urlencode($text) |
|
54 | - . '&username='. urlencode($this->config['username']) |
|
55 | - . '&as_user=false&icon_url=http%3A%2F%2Fcherry-pie.co%2Fimg%2Flog-envelope.png&mrkdwn=1&pretty=1&attachments='. urlencode(json_encode([$attachments])); |
|
51 | + . 'token=' . $this->config['token'] |
|
52 | + . '&channel=' . urlencode($this->config['channel']) |
|
53 | + . '&text=' . urlencode($text) |
|
54 | + . '&username=' . urlencode($this->config['username']) |
|
55 | + . '&as_user=false&icon_url=http%3A%2F%2Fcherry-pie.co%2Fimg%2Flog-envelope.png&mrkdwn=1&pretty=1&attachments=' . urlencode(json_encode([$attachments])); |
|
56 | 56 | |
57 | 57 | @file_get_contents($url); |
58 | 58 | } // end send |