@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function handleError($code, $message, $file = '', $line = 0, $context = array()) |
150 | 150 | { |
151 | - if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { |
|
151 | + if ($this->handleOnlyReportedErrors && !(error_reporting()&$code)) { |
|
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
155 | 155 | // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries |
156 | 156 | if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { |
157 | 157 | $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL; |
158 | - $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line)); |
|
158 | + $this->logger->log($level, self::codeToString($code) . ': ' . $message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line)); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if ($this->previousErrorHandler === true) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($lastError && in_array($lastError['type'], self::$fatalErrors, true)) { |
177 | 177 | $this->logger->log( |
178 | 178 | $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel, |
179 | - 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'], |
|
179 | + 'Fatal Error (' . self::codeToString($lastError['type']) . '): ' . $lastError['message'], |
|
180 | 180 | array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line']) |
181 | 181 | ); |
182 | 182 |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public function pushProcessor($callback) |
229 | 229 | { |
230 | 230 | if (!is_callable($callback)) { |
231 | - throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); |
|
231 | + throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), ' . var_export($callback, true) . ' given'); |
|
232 | 232 | } |
233 | 233 | array_unshift($this->processors, $callback); |
234 | 234 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | public static function getLevelName($level) |
460 | 460 | { |
461 | 461 | if (!isset(static::$levels[$level])) { |
462 | - throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels))); |
|
462 | + throw new InvalidArgumentException('Level "' . $level . '" is not defined, use one of: ' . implode(', ', array_keys(static::$levels))); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | return static::$levels[$level]; |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | */ |
474 | 474 | public static function toMonologLevel($level) |
475 | 475 | { |
476 | - if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) { |
|
477 | - return constant(__CLASS__.'::'.strtoupper($level)); |
|
476 | + if (is_string($level) && defined(__CLASS__ . '::' . strtoupper($level))) { |
|
477 | + return constant(__CLASS__ . '::' . strtoupper($level)); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | return $level; |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | { |
56 | 56 | $th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8'); |
57 | 57 | if ($escapeTd) { |
58 | - $td = '<pre>'.htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8').'</pre>'; |
|
58 | + $td = '<pre>' . htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8') . '</pre>'; |
|
59 | 59 | } |
60 | 60 | |
61 | - return "<tr style=\"padding: 4px;spacing: 0;text-align: left;\">\n<th style=\"background: #cccccc\" width=\"100px\">$th:</th>\n<td style=\"padding: 4px;spacing: 0;text-align: left;background: #eeeeee\">".$td."</td>\n</tr>"; |
|
61 | + return "<tr style=\"padding: 4px;spacing: 0;text-align: left;\">\n<th style=\"background: #cccccc\" width=\"100px\">$th:</th>\n<td style=\"padding: 4px;spacing: 0;text-align: left;background: #eeeeee\">" . $td . "</td>\n</tr>"; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); |
74 | 74 | |
75 | - return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>'; |
|
75 | + return '<h1 style="background: ' . $this->logLevels[$level] . ';color: #ffffff;padding: 5px;" class="monolog-output">' . $title . '</h1>'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $output .= $this->addRow('Extra', $embeddedTable, false); |
107 | 107 | } |
108 | 108 | |
109 | - return $output.'</table>'; |
|
109 | + return $output . '</table>'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | $data = $this->normalize($data); |
135 | 135 | if (version_compare(PHP_VERSION, '5.4.0', '>=')) { |
136 | - return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
|
136 | + return json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return str_replace('\\/', '/', json_encode($data)); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | // Retrieve the line and file if set and remove them from the formatted extra |
43 | 43 | $backtrace = 'unknown'; |
44 | 44 | if (isset($record['extra']['file'], $record['extra']['line'])) { |
45 | - $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; |
|
45 | + $backtrace = $record['extra']['file'] . ' : ' . $record['extra']['line']; |
|
46 | 46 | unset($record['extra']['file'], $record['extra']['line']); |
47 | 47 | } |
48 | 48 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | $record = parent::format($record); |
78 | 78 | |
79 | 79 | if (!isset($record['datetime'], $record['message'], $record['level'])) { |
80 | - throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, '.var_export($record, true).' given'); |
|
80 | + throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, ' . var_export($record, true) . ' given'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $message = new Message(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $count = 1; |
77 | 77 | foreach ($data as $key => $value) { |
78 | 78 | if ($count++ >= 1000) { |
79 | - $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; |
|
79 | + $normalized['...'] = 'Over 1000 items (' . count($data) . ' total), aborting normalization'; |
|
80 | 80 | break; |
81 | 81 | } |
82 | 82 | $normalized[$key] = $this->normalize($value); |
@@ -110,21 +110,21 @@ discard block |
||
110 | 110 | return sprintf('[resource] (%s)', get_resource_type($data)); |
111 | 111 | } |
112 | 112 | |
113 | - return '[unknown('.gettype($data).')]'; |
|
113 | + return '[unknown(' . gettype($data) . ')]'; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | protected function normalizeException($e) |
117 | 117 | { |
118 | 118 | // TODO 2.0 only check for Throwable |
119 | 119 | if (!$e instanceof Exception && !$e instanceof \Throwable) { |
120 | - throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e)); |
|
120 | + throw new \InvalidArgumentException('Exception/Throwable expected, got ' . gettype($e) . ' / ' . get_class($e)); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $data = array( |
124 | 124 | 'class' => get_class($e), |
125 | 125 | 'message' => $e->getMessage(), |
126 | 126 | 'code' => $e->getCode(), |
127 | - 'file' => $e->getFile().':'.$e->getLine(), |
|
127 | + 'file' => $e->getFile() . ':' . $e->getLine(), |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | if ($e instanceof \SoapFault) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $trace = $e->getTrace(); |
145 | 145 | foreach ($trace as $frame) { |
146 | 146 | if (isset($frame['file'])) { |
147 | - $data['trace'][] = $frame['file'].':'.$frame['line']; |
|
147 | + $data['trace'][] = $frame['file'] . ':' . $frame['line']; |
|
148 | 148 | } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { |
149 | 149 | // We should again normalize the frames, because it might contain invalid items |
150 | 150 | $data['trace'][] = $frame['function']; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | private function jsonEncode($data) |
193 | 193 | { |
194 | 194 | if (version_compare(PHP_VERSION, '5.4.0', '>=')) { |
195 | - return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
|
195 | + return json_encode($data, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return json_encode($data); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $msg = 'Unknown error'; |
261 | 261 | } |
262 | 262 | |
263 | - throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); |
|
263 | + throw new \RuntimeException('JSON encoding failed: ' . $msg . '. Encoding: ' . var_export($data, true)); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if (is_string($data) && !preg_match('//u', $data)) { |
285 | 285 | $data = preg_replace_callback( |
286 | 286 | '/[\x80-\xFF]+/', |
287 | - function ($m) { return utf8_encode($m[0]); }, |
|
287 | + function($m) { return utf8_encode($m[0]); }, |
|
288 | 288 | $data |
289 | 289 | ); |
290 | 290 | $data = str_replace( |
@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | if (isset($record['context'][self::TABLE])) { |
73 | 73 | $type = 'TABLE'; |
74 | - $label = $record['channel'] .': '. $record['message']; |
|
74 | + $label = $record['channel'] . ': ' . $record['message']; |
|
75 | 75 | $message = $record['context'][self::TABLE]; |
76 | 76 | } else { |
77 | 77 | $type = $this->logLevels[$record['level']]; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $oldNewline = $this->appendNewline; |
125 | 125 | $this->appendNewline = false; |
126 | - array_walk($records, function (&$value, $key) use ($instance) { |
|
126 | + array_walk($records, function(&$value, $key) use ($instance) { |
|
127 | 127 | $value = $instance->format($value); |
128 | 128 | }); |
129 | 129 | $this->appendNewline = $oldNewline; |
@@ -174,21 +174,21 @@ discard block |
||
174 | 174 | { |
175 | 175 | // TODO 2.0 only check for Throwable |
176 | 176 | if (!$e instanceof Exception && !$e instanceof Throwable) { |
177 | - throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e)); |
|
177 | + throw new \InvalidArgumentException('Exception/Throwable expected, got ' . gettype($e) . ' / ' . get_class($e)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $data = array( |
181 | 181 | 'class' => get_class($e), |
182 | 182 | 'message' => $e->getMessage(), |
183 | 183 | 'code' => $e->getCode(), |
184 | - 'file' => $e->getFile().':'.$e->getLine(), |
|
184 | + 'file' => $e->getFile() . ':' . $e->getLine(), |
|
185 | 185 | ); |
186 | 186 | |
187 | 187 | if ($this->includeStacktraces) { |
188 | 188 | $trace = $e->getTrace(); |
189 | 189 | foreach ($trace as $frame) { |
190 | 190 | if (isset($frame['file'])) { |
191 | - $data['trace'][] = $frame['file'].':'.$frame['line']; |
|
191 | + $data['trace'][] = $frame['file'] . ':' . $frame['line']; |
|
192 | 192 | } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { |
193 | 193 | // We should again normalize the frames, because it might contain invalid items |
194 | 194 | $data['trace'][] = $frame['function']; |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | $output = $this->format; |
71 | 71 | |
72 | 72 | foreach ($vars['extra'] as $var => $val) { |
73 | - if (false !== strpos($output, '%extra.'.$var.'%')) { |
|
74 | - $output = str_replace('%extra.'.$var.'%', $this->stringify($val), $output); |
|
73 | + if (false !== strpos($output, '%extra.' . $var . '%')) { |
|
74 | + $output = str_replace('%extra.' . $var . '%', $this->stringify($val), $output); |
|
75 | 75 | unset($vars['extra'][$var]); |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | foreach ($vars['context'] as $var => $val) { |
81 | - if (false !== strpos($output, '%context.'.$var.'%')) { |
|
82 | - $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output); |
|
81 | + if (false !== strpos($output, '%context.' . $var . '%')) { |
|
82 | + $output = str_replace('%context.' . $var . '%', $this->stringify($val), $output); |
|
83 | 83 | unset($vars['context'][$var]); |
84 | 84 | } |
85 | 85 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | foreach ($vars as $var => $val) { |
100 | - if (false !== strpos($output, '%'.$var.'%')) { |
|
101 | - $output = str_replace('%'.$var.'%', $this->stringify($val), $output); |
|
100 | + if (false !== strpos($output, '%' . $var . '%')) { |
|
101 | + $output = str_replace('%' . $var . '%', $this->stringify($val), $output); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | { |
130 | 130 | // TODO 2.0 only check for Throwable |
131 | 131 | if (!$e instanceof \Exception && !$e instanceof \Throwable) { |
132 | - throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e)); |
|
132 | + throw new \InvalidArgumentException('Exception/Throwable expected, got ' . gettype($e) . ' / ' . get_class($e)); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $previousText = ''; |
136 | 136 | if ($previous = $e->getPrevious()) { |
137 | 137 | do { |
138 | - $previousText .= ', '.get_class($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine(); |
|
138 | + $previousText .= ', ' . get_class($previous) . '(code: ' . $previous->getCode() . '): ' . $previous->getMessage() . ' at ' . $previous->getFile() . ':' . $previous->getLine(); |
|
139 | 139 | } while ($previous = $previous->getPrevious()); |
140 | 140 | } |
141 | 141 | |
142 | - $str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')'; |
|
142 | + $str = '[object] (' . get_class($e) . '(code: ' . $e->getCode() . '): ' . $e->getMessage() . ' at ' . $e->getFile() . ':' . $e->getLine() . $previousText . ')'; |
|
143 | 143 | if ($this->includeStacktraces) { |
144 | - $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n"; |
|
144 | + $str .= "\n[stacktrace]\n" . $e->getTraceAsString() . "\n"; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | return $str; |