@@ -104,7 +104,7 @@ |
||
| 104 | 104 | /** |
| 105 | 105 | * Parse respnse into array |
| 106 | 106 | * |
| 107 | - * @param type $response |
|
| 107 | + * @param string $response |
|
| 108 | 108 | * @param string $requestData |
| 109 | 109 | * @return array |
| 110 | 110 | */ |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | if (!$responseArr) |
| 133 | 133 | { |
| 134 | - throw new HandlerException('Cannot create connection to ' . $this->apiUrl); |
|
| 134 | + throw new HandlerException('Cannot create connection to '.$this->apiUrl); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (isset($responseArr['error'])) |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | throw new HandlerException($responseArr['error']); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - throw new HandlerException('Error. ' . ' Request data: ' . json_decode($requestData)); |
|
| 142 | + throw new HandlerException('Error. '.' Request data: '.json_decode($requestData)); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * Serialize data and send to storage |
| 31 | 31 | * |
| 32 | 32 | * @param array $requestData |
| 33 | - * @return array |
|
| 33 | + * @return type|null |
|
| 34 | 34 | */ |
| 35 | 35 | public function handle(array $requestData) |
| 36 | 36 | { |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | } |
| 20 | 20 | catch (\Exception $ex) |
| 21 | 21 | { |
| 22 | - if ( ! $this->silent) |
|
| 22 | + if (!$this->silent) |
|
| 23 | 23 | { |
| 24 | 24 | throw new \Understand\UnderstandLaravel5\Exceptions\HandlerException($ex->getMessage(), $ex->getCode(), $ex); |
| 25 | 25 | } |
@@ -125,8 +125,7 @@ |
||
| 125 | 125 | try |
| 126 | 126 | { |
| 127 | 127 | return $this->handler->handle($event); |
| 128 | - } |
|
| 129 | - catch (\Exception $ex) |
|
| 128 | + } catch (\Exception $ex) |
|
| 130 | 129 | { |
| 131 | 130 | if (! $this->silent) |
| 132 | 131 | { |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | protected $silent = true; |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @param \Understand\UnderstandLaravel\FieldProvider $fieldProvider |
|
| 32 | - * @param \Understand\UnderstandLaravel\Handlers\BaseHandler $handler |
|
| 31 | + * @param FieldProvider $fieldProvider |
|
| 32 | + * @param BaseHandler $handler |
|
| 33 | 33 | * @param bool $silent |
| 34 | 34 | */ |
| 35 | 35 | public function __construct(FieldProvider $fieldProvider, BaseHandler $handler, $silent = true) |
@@ -56,7 +56,6 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * Send multiple events |
| 58 | 58 | * |
| 59 | - * @param array $data |
|
| 60 | 59 | * @return array |
| 61 | 60 | */ |
| 62 | 61 | public function bulkLog(array $events, array $additional = []) |
@@ -107,7 +106,7 @@ discard block |
||
| 107 | 106 | /** |
| 108 | 107 | * Set field provider |
| 109 | 108 | * |
| 110 | - * @param \Understand\UnderstandLaravel\FieldProvider $fieldProvider |
|
| 109 | + * @param FieldProvider $fieldProvider |
|
| 111 | 110 | */ |
| 112 | 111 | public function setFieldProvider(FieldProvider $fieldProvider) |
| 113 | 112 | { |
@@ -117,7 +116,6 @@ discard block |
||
| 117 | 116 | /** |
| 118 | 117 | * Send data to storage |
| 119 | 118 | * |
| 120 | - * @param array $requestData |
|
| 121 | 119 | * @return mixed |
| 122 | 120 | */ |
| 123 | 121 | protected function send(array $event) |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | } |
| 129 | 129 | catch (\Exception $ex) |
| 130 | 130 | { |
| 131 | - if (! $this->silent) |
|
| 131 | + if (!$this->silent) |
|
| 132 | 132 | { |
| 133 | 133 | throw new $ex; |
| 134 | 134 | } |
@@ -125,8 +125,7 @@ |
||
| 125 | 125 | try |
| 126 | 126 | { |
| 127 | 127 | return $this->handler->handle($event); |
| 128 | - } |
|
| 129 | - catch (\Exception $ex) |
|
| 128 | + } catch (\Exception $ex) |
|
| 130 | 129 | { |
| 131 | 130 | if (! $this->silent) |
| 132 | 131 | { |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | protected $additionalFields; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * @param Understand\UnderstandLaravel\Logger $logger |
|
| 24 | + * @param Logger $logger |
|
| 25 | 25 | * |
| 26 | - * @param \Understand\UnderstandLaravel\Logger $logger |
|
| 26 | + * @param Logger $logger |
|
| 27 | 27 | * @param array $additionalFields |
| 28 | 28 | */ |
| 29 | 29 | public function __construct(Logger $logger, array $additionalFields) |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | /** |
| 278 | 278 | * Get the services provided by the provider. |
| 279 | 279 | * |
| 280 | - * @return array |
|
| 280 | + * @return string[] |
|
| 281 | 281 | */ |
| 282 | 282 | public function provides() |
| 283 | 283 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function boot() |
| 22 | 22 | { |
| 23 | - $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
|
| 23 | + $configPath = __DIR__.'/../../config/understand-laravel.php'; |
|
| 24 | 24 | $this->publishes([$configPath => config_path('understand-laravel.php')], 'config'); |
| 25 | 25 | |
| 26 | 26 | if ($this->app['config']->get('understand-laravel.log_types.eloquent_log.enabled')) |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | protected function registerConfig() |
| 59 | 59 | { |
| 60 | - $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
|
| 60 | + $configPath = __DIR__.'/../../config/understand-laravel.php'; |
|
| 61 | 61 | $this->mergeConfigFrom($configPath, 'understand-laravel'); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return new Handlers\LaravelQueueHandler($inputToken, $apiUrl, $silent, $sslBundlePath); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - throw new \ErrorException('understand-laravel handler misconfiguration:' . $handlerType); |
|
| 192 | + throw new \ErrorException('understand-laravel handler misconfiguration:'.$handlerType); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -6,20 +6,20 @@ discard block |
||
| 6 | 6 | class UnderstandLaravel5ServiceProvider extends ServiceProvider |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Indicates if loading of the provider is deferred. |
|
| 11 | - * |
|
| 12 | - * @var bool |
|
| 13 | - */ |
|
| 14 | - protected $defer = false; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * Bootstrap the application events. |
|
| 18 | - * |
|
| 19 | - * @return void |
|
| 20 | - */ |
|
| 21 | - public function boot() |
|
| 22 | - { |
|
| 9 | + /** |
|
| 10 | + * Indicates if loading of the provider is deferred. |
|
| 11 | + * |
|
| 12 | + * @var bool |
|
| 13 | + */ |
|
| 14 | + protected $defer = false; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * Bootstrap the application events. |
|
| 18 | + * |
|
| 19 | + * @return void |
|
| 20 | + */ |
|
| 21 | + public function boot() |
|
| 22 | + { |
|
| 23 | 23 | $configPath = __DIR__ . '/../../config/understand-laravel.php'; |
| 24 | 24 | $this->publishes([$configPath => config_path('understand-laravel.php')], 'config'); |
| 25 | 25 | |
@@ -32,23 +32,23 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $this->listenLaravelEvents(); |
| 34 | 34 | } |
| 35 | - } |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * Register the service provider. |
|
| 39 | - * |
|
| 40 | - * @return void |
|
| 41 | - */ |
|
| 42 | - public function register() |
|
| 43 | - { |
|
| 44 | - $this->registerConfig(); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * Register the service provider. |
|
| 39 | + * |
|
| 40 | + * @return void |
|
| 41 | + */ |
|
| 42 | + public function register() |
|
| 43 | + { |
|
| 44 | + $this->registerConfig(); |
|
| 45 | 45 | $this->registerFieldProvider(); |
| 46 | 46 | $this->registerTokenProvider(); |
| 47 | 47 | $this->registerLogger(); |
| 48 | 48 | $this->registerModelEventListenerProvider(); |
| 49 | 49 | $this->registerExceptionEncoder(); |
| 50 | 50 | $this->registerExceptionLogger(); |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Register config |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $fieldProvider = new FieldProvider(); |
| 74 | 74 | |
| 75 | - if ($app['config']['session.driver']) |
|
| 76 | - { |
|
| 75 | + if ($app['config']['session.driver']) |
|
| 76 | + { |
|
| 77 | 77 | $fieldProvider->setSessionStore($app['session.store']); |
| 78 | 78 | } |
| 79 | 79 | $fieldProvider->setRouter($app['router']); |
@@ -228,8 +228,7 @@ discard block |
||
| 228 | 228 | { |
| 229 | 229 | $this->handleEvent($level, $message, $context); |
| 230 | 230 | }); |
| 231 | - } |
|
| 232 | - else |
|
| 231 | + } else |
|
| 233 | 232 | { |
| 234 | 233 | // starting from L5.4 MessageLogged event class was introduced |
| 235 | 234 | // https://github.com/laravel/framework/commit/57c82d095c356a0fe0f9381536afec768cdcc072 |
@@ -254,18 +253,15 @@ discard block |
||
| 254 | 253 | if ($message instanceof Exceptions\HandlerException) |
| 255 | 254 | { |
| 256 | 255 | return; |
| 257 | - } |
|
| 258 | - else if ($message instanceof \Exception) |
|
| 256 | + } else if ($message instanceof \Exception) |
|
| 259 | 257 | { |
| 260 | 258 | $log = $this->app['understand.exception-encoder']->exceptionToArray($message); |
| 261 | 259 | $log['tags'] = ['exception_log']; |
| 262 | - } |
|
| 263 | - else if (is_string($message)) |
|
| 260 | + } else if (is_string($message)) |
|
| 264 | 261 | { |
| 265 | 262 | $log['message'] = $message; |
| 266 | 263 | $log['tags'] = ['laravel_log']; |
| 267 | - } |
|
| 268 | - else |
|
| 264 | + } else |
|
| 269 | 265 | { |
| 270 | 266 | $log = $message; |
| 271 | 267 | $log['tags'] = ['laravel_log']; |
@@ -125,28 +125,22 @@ |
||
| 125 | 125 | if (is_array($arg)) |
| 126 | 126 | { |
| 127 | 127 | $params[] = 'array(' . count($arg) . ')'; |
| 128 | - } |
|
| 129 | - else if (is_object($arg)) |
|
| 128 | + } else if (is_object($arg)) |
|
| 130 | 129 | { |
| 131 | 130 | $params[] = get_class($arg); |
| 132 | - } |
|
| 133 | - else if (is_string($arg)) |
|
| 131 | + } else if (is_string($arg)) |
|
| 134 | 132 | { |
| 135 | 133 | $params[] = 'string(' . $arg . ')'; |
| 136 | - } |
|
| 137 | - else if (is_int($arg)) |
|
| 134 | + } else if (is_int($arg)) |
|
| 138 | 135 | { |
| 139 | 136 | $params[] = 'int(' . $arg . ')'; |
| 140 | - } |
|
| 141 | - else if (is_float($arg)) |
|
| 137 | + } else if (is_float($arg)) |
|
| 142 | 138 | { |
| 143 | 139 | $params[] = 'float(' . $arg . ')'; |
| 144 | - } |
|
| 145 | - else if (is_bool($arg)) |
|
| 140 | + } else if (is_bool($arg)) |
|
| 146 | 141 | { |
| 147 | 142 | $params[] = 'bool(' . ($arg ? 'true' : 'false') . ')'; |
| 148 | - } |
|
| 149 | - else |
|
| 143 | + } else |
|
| 150 | 144 | { |
| 151 | 145 | $params[] = (string) $arg; |
| 152 | 146 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function stackTraceCallToString(array $trace) |
| 91 | 91 | { |
| 92 | - if (! isset($trace['type'])) |
|
| 92 | + if (!isset($trace['type'])) |
|
| 93 | 93 | { |
| 94 | 94 | return 'function'; |
| 95 | 95 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $params = []; |
| 117 | 117 | |
| 118 | - if (! isset($trace['args'])) |
|
| 118 | + if (!isset($trace['args'])) |
|
| 119 | 119 | { |
| 120 | 120 | return $params; |
| 121 | 121 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | if (is_array($arg)) |
| 126 | 126 | { |
| 127 | - $params[] = 'array(' . count($arg) . ')'; |
|
| 127 | + $params[] = 'array('.count($arg).')'; |
|
| 128 | 128 | } |
| 129 | 129 | else if (is_object($arg)) |
| 130 | 130 | { |
@@ -132,19 +132,19 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | else if (is_string($arg)) |
| 134 | 134 | { |
| 135 | - $params[] = 'string(' . $arg . ')'; |
|
| 135 | + $params[] = 'string('.$arg.')'; |
|
| 136 | 136 | } |
| 137 | 137 | else if (is_int($arg)) |
| 138 | 138 | { |
| 139 | - $params[] = 'int(' . $arg . ')'; |
|
| 139 | + $params[] = 'int('.$arg.')'; |
|
| 140 | 140 | } |
| 141 | 141 | else if (is_float($arg)) |
| 142 | 142 | { |
| 143 | - $params[] = 'float(' . $arg . ')'; |
|
| 143 | + $params[] = 'float('.$arg.')'; |
|
| 144 | 144 | } |
| 145 | 145 | else if (is_bool($arg)) |
| 146 | 146 | { |
| 147 | - $params[] = 'bool(' . ($arg ? 'true' : 'false') . ')'; |
|
| 147 | + $params[] = 'bool('.($arg ? 'true' : 'false').')'; |
|
| 148 | 148 | } |
| 149 | 149 | else |
| 150 | 150 | { |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if ( ! $this->config->get('understand-laravel.log_types.exception_log.enabled')) |
|
| 60 | + if (!$this->config->get('understand-laravel.log_types.exception_log.enabled')) |
|
| 61 | 61 | { |
| 62 | 62 | return; |
| 63 | 63 | } |
@@ -315,8 +315,7 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | return $userId; |
| 317 | 317 | } |
| 318 | - } |
|
| 319 | - catch (\Exception $e) |
|
| 318 | + } catch (\Exception $e) |
|
| 320 | 319 | {} |
| 321 | 320 | |
| 322 | 321 | try |
@@ -325,8 +324,7 @@ discard block |
||
| 325 | 324 | { |
| 326 | 325 | return $user->id; |
| 327 | 326 | } |
| 328 | - } |
|
| 329 | - catch (\Exception $e) |
|
| 327 | + } catch (\Exception $e) |
|
| 330 | 328 | {} |
| 331 | 329 | |
| 332 | 330 | try |
@@ -335,8 +333,7 @@ discard block |
||
| 335 | 333 | { |
| 336 | 334 | return $user->id; |
| 337 | 335 | } |
| 338 | - } |
|
| 339 | - catch (\Exception $e) |
|
| 336 | + } catch (\Exception $e) |
|
| 340 | 337 | {} |
| 341 | 338 | } |
| 342 | 339 | |
@@ -72,7 +72,6 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * Create field provider instance and set default providers to provider list |
| 74 | 74 | * |
| 75 | - * @param type $app |
|
| 76 | 75 | * @return void |
| 77 | 76 | */ |
| 78 | 77 | public function __construct() |
@@ -86,7 +85,7 @@ discard block |
||
| 86 | 85 | /** |
| 87 | 86 | * Set session store |
| 88 | 87 | * |
| 89 | - * @param type $service |
|
| 88 | + * @param SessionStore $service |
|
| 90 | 89 | */ |
| 91 | 90 | public function setSessionStore(SessionStore $service) |
| 92 | 91 | { |
@@ -127,7 +126,6 @@ discard block |
||
| 127 | 126 | * Register a custom HTML macro. |
| 128 | 127 | * |
| 129 | 128 | * @param string $name |
| 130 | - * @param mixed $macro |
|
| 131 | 129 | * @return void |
| 132 | 130 | */ |
| 133 | 131 | public function extend($name, $provider) |
@@ -138,7 +136,7 @@ discard block |
||
| 138 | 136 | /** |
| 139 | 137 | * Set token provider |
| 140 | 138 | * |
| 141 | - * @param UniqueProcessIdentifier $tokenProvider |
|
| 139 | + * @param TokenProvider $tokenProvider |
|
| 142 | 140 | */ |
| 143 | 141 | public function setTokenProvider(TokenProvider $tokenProvider) |
| 144 | 142 | { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | protected function getSessionId() |
| 201 | 201 | { |
| 202 | - if ( ! $this->session) |
|
| 202 | + if (!$this->session) |
|
| 203 | 203 | { |
| 204 | 204 | return null; |
| 205 | 205 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | protected function getRouteName() |
| 221 | 221 | { |
| 222 | - if ( ! $this->router) |
|
| 222 | + if (!$this->router) |
|
| 223 | 223 | { |
| 224 | 224 | return null; |
| 225 | 225 | } |
@@ -234,23 +234,23 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | protected function getUrl() |
| 236 | 236 | { |
| 237 | - if ( ! $this->request) |
|
| 237 | + if (!$this->request) |
|
| 238 | 238 | { |
| 239 | 239 | return null; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $url = $this->request->path(); |
| 243 | 243 | |
| 244 | - if ( ! starts_with($url, '/')) |
|
| 244 | + if (!starts_with($url, '/')) |
|
| 245 | 245 | { |
| 246 | - $url = '/' . $url; |
|
| 246 | + $url = '/'.$url; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $queryString = $this->request->getQueryString(); |
| 250 | 250 | |
| 251 | 251 | if ($queryString) |
| 252 | 252 | { |
| 253 | - $url .= '?' . $queryString; |
|
| 253 | + $url .= '?'.$queryString; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | return $url; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | protected function getRequestMethod() |
| 265 | 265 | { |
| 266 | - if ( ! $this->request) |
|
| 266 | + if (!$this->request) |
|
| 267 | 267 | { |
| 268 | 268 | return null; |
| 269 | 269 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | protected function getServerIp() |
| 280 | 280 | { |
| 281 | - if ( ! $this->request) |
|
| 281 | + if (!$this->request) |
|
| 282 | 282 | { |
| 283 | 283 | return null; |
| 284 | 284 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | protected function getClientIp() |
| 295 | 295 | { |
| 296 | - if ( ! $this->request) |
|
| 296 | + if (!$this->request) |
|
| 297 | 297 | { |
| 298 | 298 | return null; |
| 299 | 299 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | protected function getClientUserAgent() |
| 310 | 310 | { |
| 311 | - if ( ! $this->request) |
|
| 311 | + if (!$this->request) |
|
| 312 | 312 | { |
| 313 | 313 | return null; |
| 314 | 314 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | protected function getFromSession($key) |
| 336 | 336 | { |
| 337 | - if ( ! $this->session) |
|
| 337 | + if (!$this->session) |
|
| 338 | 338 | { |
| 339 | 339 | return null; |
| 340 | 340 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public function __construct($message = '', $code = 0, $previous = null) |
| 12 | 12 | { |
| 13 | - $message = 'understand-laravel: ' . $message; |
|
| 13 | + $message = 'understand-laravel: '.$message; |
|
| 14 | 14 | |
| 15 | 15 | parent::__construct($message, $code, $previous); |
| 16 | 16 | } |