@@ -141,6 +141,9 @@ |
||
141 | 141 | return http_build_query($dataArray); |
142 | 142 | } |
143 | 143 | |
144 | + /** |
|
145 | + * @param string $content |
|
146 | + */ |
|
144 | 147 | private function buildHeader($content) |
145 | 148 | { |
146 | 149 | $header = "POST /1/messages.json HTTP/1.1\r\n"; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | $content = $this->buildContent($record); |
99 | 99 | |
100 | - return $this->buildHeader($content) . $content; |
|
100 | + return $this->buildHeader($content).$content; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | private function buildContent($record) |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $header = "POST /1/messages.json HTTP/1.1\r\n"; |
147 | 147 | $header .= "Host: api.pushover.net\r\n"; |
148 | 148 | $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
149 | - $header .= "Content-Length: " . strlen($content) . "\r\n"; |
|
149 | + $header .= "Content-Length: ".strlen($content)."\r\n"; |
|
150 | 150 | $header .= "\r\n"; |
151 | 151 | |
152 | 152 | return $header; |
@@ -212,7 +212,7 @@ |
||
212 | 212 | /** |
213 | 213 | * Gets extra parameters supported by Raven that can be found in "extra" and "context" |
214 | 214 | * |
215 | - * @return array |
|
215 | + * @return string[] |
|
216 | 216 | */ |
217 | 217 | protected function getExtraParameters() |
218 | 218 | { |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\Formatter\LineFormatter; |
|
15 | 14 | use Monolog\Formatter\FormatterInterface; |
15 | +use Monolog\Formatter\LineFormatter; |
|
16 | 16 | use Monolog\Logger; |
17 | 17 | use Raven_Client; |
18 | 18 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $level = $this->level; |
75 | 75 | |
76 | 76 | // filter records based on their level |
77 | - $records = array_filter($records, function ($record) use ($level) { |
|
77 | + $records = array_filter($records, function($record) use ($level) { |
|
78 | 78 | return $record['level'] >= $level; |
79 | 79 | }); |
80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // the record with the highest severity is the "main" one |
86 | - $record = array_reduce($records, function ($highest, $record) { |
|
86 | + $record = array_reduce($records, function($highest, $record){ |
|
87 | 87 | if ($record['level'] > $highest['level']) { |
88 | 88 | return $record; |
89 | 89 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $level = $this->level; |
75 | 75 | |
76 | 76 | // filter records based on their level |
77 | - $records = array_filter($records, function ($record) use ($level) { |
|
77 | + $records = array_filter($records, function ($record) use ($level){ |
|
78 | 78 | return $record['level'] >= $level; |
79 | 79 | }); |
80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // the record with the highest severity is the "main" one |
86 | - $record = array_reduce($records, function ($highest, $record) { |
|
86 | + $record = array_reduce($records, function ($highest, $record){ |
|
87 | 87 | if ($record['level'] > $highest['level']) { |
88 | 88 | return $record; |
89 | 89 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | protected $factor; |
39 | 39 | |
40 | 40 | /** |
41 | - * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). |
|
41 | + * @param TestHandler $handler Handler or factory callable($record, $fingersCrossedHandler). |
|
42 | 42 | * @param int $factor Sample factor |
43 | 43 | */ |
44 | 44 | public function __construct($handler, $factor) |
@@ -85,6 +85,11 @@ |
||
85 | 85 | */ |
86 | 86 | private $normalizerFormatter; |
87 | 87 | |
88 | + /** |
|
89 | + * @param string $channel |
|
90 | + * @param string $username |
|
91 | + * @param string $userIcon |
|
92 | + */ |
|
88 | 93 | public function __construct($channel = null, $username = null, $useAttachment = true, $userIcon = null, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array(), FormatterInterface $formatter = null) |
89 | 94 | { |
90 | 95 | $this->channel = $channel; |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler\Slack; |
13 | 13 | |
14 | -use Monolog\Logger; |
|
15 | -use Monolog\Formatter\NormalizerFormatter; |
|
16 | 14 | use Monolog\Formatter\FormatterInterface; |
15 | +use Monolog\Formatter\NormalizerFormatter; |
|
16 | +use Monolog\Logger; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Slack record utility helping to log to Slack webhooks or API. |
@@ -12,8 +12,8 @@ |
||
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | 14 | use Monolog\Formatter\FormatterInterface; |
15 | -use Monolog\Logger; |
|
16 | 15 | use Monolog\Handler\Slack\SlackRecord; |
16 | +use Monolog\Logger; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Sends notifications through Slack API |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | $content = $this->buildContent($record); |
92 | 92 | |
93 | - return $this->buildHeader($content) . $content; |
|
93 | + return $this->buildHeader($content).$content; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $header = "POST /api/chat.postMessage HTTP/1.1\r\n"; |
136 | 136 | $header .= "Host: slack.com\r\n"; |
137 | 137 | $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
138 | - $header .= "Content-Length: " . strlen($content) . "\r\n"; |
|
138 | + $header .= "Content-Length: ".strlen($content)."\r\n"; |
|
139 | 139 | $header .= "\r\n"; |
140 | 140 | |
141 | 141 | return $header; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Get current in-transfer timeout |
173 | 173 | * |
174 | - * @return float |
|
174 | + * @return integer |
|
175 | 175 | */ |
176 | 176 | public function getTimeout() |
177 | 177 | { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | /** |
182 | 182 | * Get current local writing timeout |
183 | 183 | * |
184 | - * @return float |
|
184 | + * @return integer |
|
185 | 185 | */ |
186 | 186 | public function getWritingTimeout() |
187 | 187 | { |
@@ -266,6 +266,9 @@ discard block |
||
266 | 266 | return stream_get_meta_data($this->resource); |
267 | 267 | } |
268 | 268 | |
269 | + /** |
|
270 | + * @param double $value |
|
271 | + */ |
|
269 | 272 | private function validateTimeout($value) |
270 | 273 | { |
271 | 274 | $ok = filter_var($value, FILTER_VALIDATE_FLOAT); |
@@ -329,6 +332,9 @@ discard block |
||
329 | 332 | } |
330 | 333 | } |
331 | 334 | |
335 | + /** |
|
336 | + * @param string $data |
|
337 | + */ |
|
332 | 338 | private function writeToSocket($data) |
333 | 339 | { |
334 | 340 | $length = strlen($data); |
@@ -358,6 +364,9 @@ discard block |
||
358 | 364 | } |
359 | 365 | } |
360 | 366 | |
367 | + /** |
|
368 | + * @param integer $sent |
|
369 | + */ |
|
361 | 370 | private function writingIsTimedOut($sent) |
362 | 371 | { |
363 | 372 | $writingTimeout = (int) floor($this->writingTimeout); |
@@ -208,7 +208,7 @@ |
||
208 | 208 | public function isConnected() |
209 | 209 | { |
210 | 210 | return is_resource($this->resource) |
211 | - && !feof($this->resource); // on TCP - other party can close connection. |
|
211 | + && !feof($this->resource); // on TCP - other party can close connection. |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\Logger; |
|
15 | 14 | use Monolog\Formatter\FormatterInterface; |
16 | 15 | use Monolog\Formatter\LineFormatter; |
16 | +use Monolog\Logger; |
|
17 | 17 | use Swift; |
18 | 18 | |
19 | 19 | /** |
@@ -119,6 +119,9 @@ |
||
119 | 119 | }, $level); |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param \Closure $predicate |
|
124 | + */ |
|
122 | 125 | public function hasRecordThatPasses($predicate, $level) |
123 | 126 | { |
124 | 127 | if (!is_callable($predicate)) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $record = array('message' => $record); |
95 | 95 | } |
96 | 96 | |
97 | - return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
97 | + return $this->hasRecordThatPasses(function($rec) use ($record) { |
|
98 | 98 | if ($rec['message'] !== $record['message']) { |
99 | 99 | return false; |
100 | 100 | } |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | |
108 | 108 | public function hasRecordThatContains($message, $level) |
109 | 109 | { |
110 | - return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
110 | + return $this->hasRecordThatPasses(function($rec) use ($message) { |
|
111 | 111 | return strpos($rec['message'], $message) !== false; |
112 | 112 | }, $level); |
113 | 113 | } |
114 | 114 | |
115 | 115 | public function hasRecordThatMatches($regex, $level) |
116 | 116 | { |
117 | - return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
117 | + return $this->hasRecordThatPasses(function($rec) use ($regex) { |
|
118 | 118 | return preg_match($regex, $rec['message']) > 0; |
119 | 119 | }, $level); |
120 | 120 | } |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | public function __call($method, $args) |
151 | 151 | { |
152 | 152 | if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
153 | - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
|
154 | - $level = constant('Monolog\Logger::' . strtoupper($matches[2])); |
|
153 | + $genericMethod = $matches[1].('Records' !== $matches[3] ? 'Record' : '').$matches[3]; |
|
154 | + $level = constant('Monolog\Logger::'.strtoupper($matches[2])); |
|
155 | 155 | if (method_exists($this, $genericMethod)) { |
156 | 156 | $args[] = $level; |
157 | 157 | |
@@ -159,6 +159,6 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
|
162 | + throw new \BadMethodCallException('Call to undefined method '.get_class($this).'::'.$method.'()'); |
|
163 | 163 | } |
164 | 164 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $record = array('message' => $record); |
95 | 95 | } |
96 | 96 | |
97 | - return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
97 | + return $this->hasRecordThatPasses(function ($rec) use ($record){ |
|
98 | 98 | if ($rec['message'] !== $record['message']) { |
99 | 99 | return false; |
100 | 100 | } |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | |
108 | 108 | public function hasRecordThatContains($message, $level) |
109 | 109 | { |
110 | - return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
110 | + return $this->hasRecordThatPasses(function ($rec) use ($message){ |
|
111 | 111 | return strpos($rec['message'], $message) !== false; |
112 | 112 | }, $level); |
113 | 113 | } |
114 | 114 | |
115 | 115 | public function hasRecordThatMatches($regex, $level) |
116 | 116 | { |
117 | - return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
117 | + return $this->hasRecordThatPasses(function ($rec) use ($regex){ |
|
118 | 118 | return preg_match($regex, $rec['message']) > 0; |
119 | 119 | }, $level); |
120 | 120 | } |
@@ -162,6 +162,7 @@ |
||
162 | 162 | /** |
163 | 163 | * Return a new cloned instance with the name changed |
164 | 164 | * |
165 | + * @param string $name |
|
165 | 166 | * @return static |
166 | 167 | */ |
167 | 168 | public function withName($name) |
@@ -11,11 +11,11 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog; |
13 | 13 | |
14 | +use Exception; |
|
14 | 15 | use Monolog\Handler\HandlerInterface; |
15 | 16 | use Monolog\Handler\StreamHandler; |
16 | -use Psr\Log\LoggerInterface; |
|
17 | 17 | use Psr\Log\InvalidArgumentException; |
18 | -use Exception; |
|
18 | +use Psr\Log\LoggerInterface; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Monolog log channel |