@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb; |
11 | 11 | |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | public function boot(): void |
30 | 30 | { |
31 | 31 | $this->publishes([ |
32 | - __DIR__.'/config/influxdb.php' => config_path('influxdb.php'), |
|
32 | + __DIR__ . '/config/influxdb.php' => config_path('influxdb.php'), |
|
33 | 33 | ]); |
34 | 34 | |
35 | - $this->mergeConfigFrom(__DIR__.'/config/influxdb.php', 'influxdb'); |
|
35 | + $this->mergeConfigFrom(__DIR__ . '/config/influxdb.php', 'influxdb'); |
|
36 | 36 | |
37 | 37 | if (config('influxdb.log.monolog', false) === true) { |
38 | 38 | $handler = new MonologHandler($this->getLoggingLevel()); |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function register(): void |
53 | 53 | { |
54 | - $this->app->singleton('InfluxDb', function ($app) { |
|
54 | + $this->app->singleton('InfluxDb', function($app) { |
|
55 | 55 | try { |
56 | 56 | $timeout = is_int(config('influxdb.timeout', null)) ? config('influxdb.timeout') : 5; |
57 | 57 | $verifySsl = is_bool(config('influxdb.verify_ssl', null)) ? config('influxdb.verify_ssl') : true; |
58 | 58 | $protocol = 'influxdb'; |
59 | 59 | |
60 | - if (in_array(config('influxdb.protocol'), ['https', 'udp'])) { |
|
61 | - $protocol = config('influxdb.protocol').'+'.$protocol; |
|
60 | + if (in_array(config('influxdb.protocol'), [ 'https', 'udp' ])) { |
|
61 | + $protocol = config('influxdb.protocol') . '+' . $protocol; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $dsn = sprintf('%s://%s:%s@%s:%s/%s', |
@@ -5,9 +5,9 @@ |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | -if (! function_exists('influxdb')) { |
|
10 | +if (!function_exists('influxdb')) { |
|
11 | 11 | /** |
12 | 12 | * @return \InfluxDB\Client|\InfluxDB\Database |
13 | 13 | */ |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb\Logs; |
11 | 11 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb\Logs; |
11 | 11 | |
@@ -35,44 +35,44 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function prepareMessage(array $record): array |
37 | 37 | { |
38 | - $tags = []; |
|
39 | - $message = []; |
|
40 | - $message['name'] = 'Error'; |
|
41 | - $message['value'] = 1; |
|
42 | - $message['timestamp'] = exec('date +%s%N'); |
|
43 | - |
|
44 | - if (isset($_SERVER['REMOTE_ADDR'])) { |
|
45 | - $tags['serverName'] = $_SERVER['REMOTE_ADDR']; |
|
38 | + $tags = [ ]; |
|
39 | + $message = [ ]; |
|
40 | + $message[ 'name' ] = 'Error'; |
|
41 | + $message[ 'value' ] = 1; |
|
42 | + $message[ 'timestamp' ] = exec('date +%s%N'); |
|
43 | + |
|
44 | + if (isset($_SERVER[ 'REMOTE_ADDR' ])) { |
|
45 | + $tags[ 'serverName' ] = $_SERVER[ 'REMOTE_ADDR' ]; |
|
46 | 46 | } |
47 | 47 | |
48 | - if (isset($record['level'])) { |
|
49 | - $tags['severity'] = $this->rfc5424ToSeverity($record['level']); |
|
48 | + if (isset($record[ 'level' ])) { |
|
49 | + $tags[ 'severity' ] = $this->rfc5424ToSeverity($record[ 'level' ]); |
|
50 | 50 | } |
51 | 51 | |
52 | - if (isset($_SERVER['REQUEST_URI'])) { |
|
53 | - $tags['endpoint_url'] = $_SERVER['REQUEST_URI']; |
|
52 | + if (isset($_SERVER[ 'REQUEST_URI' ])) { |
|
53 | + $tags[ 'endpoint_url' ] = $_SERVER[ 'REQUEST_URI' ]; |
|
54 | 54 | } |
55 | 55 | |
56 | - if (isset($_SERVER['REQUEST_METHOD'])) { |
|
57 | - $tags['method'] = $_SERVER['REQUEST_METHOD']; |
|
56 | + if (isset($_SERVER[ 'REQUEST_METHOD' ])) { |
|
57 | + $tags[ 'method' ] = $_SERVER[ 'REQUEST_METHOD' ]; |
|
58 | 58 | } |
59 | 59 | |
60 | - if (isset($record['context']['user_id'])) { |
|
61 | - $tags['user_id'] = $record['context']['user_id']; |
|
60 | + if (isset($record[ 'context' ][ 'user_id' ])) { |
|
61 | + $tags[ 'user_id' ] = $record[ 'context' ][ 'user_id' ]; |
|
62 | 62 | } |
63 | 63 | |
64 | - if (isset($record['context']['project_id'])) { |
|
65 | - $tags['project_id'] = $record['context']['project_id']; |
|
64 | + if (isset($record[ 'context' ][ 'project_id' ])) { |
|
65 | + $tags[ 'project_id' ] = $record[ 'context' ][ 'project_id' ]; |
|
66 | 66 | } |
67 | 67 | |
68 | - if (isset($record['context']['file'])) { |
|
69 | - $tags['file'] = $this->replaceDigitData($record['context']['file']); |
|
68 | + if (isset($record[ 'context' ][ 'file' ])) { |
|
69 | + $tags[ 'file' ] = $this->replaceDigitData($record[ 'context' ][ 'file' ]); |
|
70 | 70 | } |
71 | 71 | |
72 | - if (isset($record['context']['event']['api_stats'][0])) { |
|
73 | - foreach ($record['context']['event']['api_stats'][0] as $k => $v) { |
|
72 | + if (isset($record[ 'context' ][ 'event' ][ 'api_stats' ][ 0 ])) { |
|
73 | + foreach ($record[ 'context' ][ 'event' ][ 'api_stats' ][ 0 ] as $k => $v) { |
|
74 | 74 | if (is_string($v) || is_int($v)) { |
75 | - $tags[$k] = $v; |
|
75 | + $tags[ $k ] = $v; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | if (isset($tags) && count($tags)) { |
81 | 81 | foreach ($tags as $k => $v) { |
82 | 82 | if (is_numeric($v)) { |
83 | - $message['fields'][$k] = (int) $v; |
|
83 | + $message[ 'fields' ][ $k ] = (int) $v; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - $message['tags'] = $tags; |
|
87 | + $message[ 'tags' ] = $tags; |
|
88 | 88 | } |
89 | 89 | |
90 | - if (isset($message['fields']['Debug']['message'])) { |
|
91 | - $message['fields']['Debug']['message'] = $this->trimLines($message['fields']['Debug']['message']); |
|
90 | + if (isset($message[ 'fields' ][ 'Debug' ][ 'message' ])) { |
|
91 | + $message[ 'fields' ][ 'Debug' ][ 'message' ] = $this->trimLines($message[ 'fields' ][ 'Debug' ][ 'message' ]); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $message; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 600 => 'Emergency', |
113 | 113 | ]; |
114 | 114 | |
115 | - $result = isset($levels[$level]) ? $levels[$level] : $levels[600]; |
|
115 | + $result = isset($levels[ $level ]) ? $levels[ $level ] : $levels[ 600 ]; |
|
116 | 116 | |
117 | 117 | return $result; |
118 | 118 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb\Jobs; |
11 | 11 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb\Jobs; |
11 | 11 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param array $args |
44 | 44 | */ |
45 | - public function __construct(array $args = []) |
|
45 | + public function __construct(array $args = [ ]) |
|
46 | 46 | { |
47 | 47 | $this->queue = config('influxdb.queue.name', 'default'); |
48 | 48 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb\Jobs; |
11 | 11 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb\Jobs; |
11 | 11 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @author Austin Heap <[email protected]> |
6 | 6 | * @version v0.1.6 |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace AustinHeap\Database\InfluxDb; |
11 | 11 |