Passed
Push — master ( 61f2d3...16fc84 )
by Austin
03:50 queued 01:19
created
src/Logs/Formatter.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function format(array $record)
23 23
     {
24
-        $record = parent::format($record);
24
+        $record=parent::format($record);
25 25
 
26
-        $message = $this->prepareMessage($record);
26
+        $message=$this->prepareMessage($record);
27 27
 
28 28
         return $message;
29 29
     }
@@ -35,43 +35,43 @@  discard block
 block discarded – undo
35 35
      */
36 36
     protected function prepareMessage(array $record): array
37 37
     {
38
-        $message = [];
39
-        $message['name'] = 'Error';
40
-        $message['value'] = 1;
41
-        $message['timestamp'] = exec('date +%s%N');
38
+        $message=[ ];
39
+        $message[ 'name' ]='Error';
40
+        $message[ 'value' ]=1;
41
+        $message[ 'timestamp' ]=exec('date +%s%N');
42 42
 
43
-        if (isset($_SERVER['REMOTE_ADDR'])) {
44
-            $tags['serverName'] = $_SERVER['REMOTE_ADDR'];
43
+        if (isset($_SERVER[ 'REMOTE_ADDR' ])) {
44
+            $tags[ 'serverName' ]=$_SERVER[ 'REMOTE_ADDR' ];
45 45
         }
46 46
 
47
-        if (isset($record['level'])) {
48
-            $tags['severity'] = $this->rfc5424ToSeverity($record['level']);
47
+        if (isset($record[ 'level' ])) {
48
+            $tags[ 'severity' ]=$this->rfc5424ToSeverity($record[ 'level' ]);
49 49
         }
50 50
 
51
-        if (isset($_SERVER['REQUEST_URI'])) {
52
-            $tags['endpoint_url'] = $_SERVER['REQUEST_URI'];
51
+        if (isset($_SERVER[ 'REQUEST_URI' ])) {
52
+            $tags[ 'endpoint_url' ]=$_SERVER[ 'REQUEST_URI' ];
53 53
         }
54 54
 
55
-        if (isset($_SERVER['REQUEST_METHOD'])) {
56
-            $tags['method'] = $_SERVER['REQUEST_METHOD'];
55
+        if (isset($_SERVER[ 'REQUEST_METHOD' ])) {
56
+            $tags[ 'method' ]=$_SERVER[ 'REQUEST_METHOD' ];
57 57
         }
58 58
 
59
-        if (isset($record['context']['user_id'])) {
60
-            $tags['user_id'] = $record['context']['user_id'];
59
+        if (isset($record[ 'context' ][ 'user_id' ])) {
60
+            $tags[ 'user_id' ]=$record[ 'context' ][ 'user_id' ];
61 61
         }
62 62
 
63
-        if (isset($record['context']['project_id'])) {
64
-            $tags['project_id'] = $record['context']['project_id'];
63
+        if (isset($record[ 'context' ][ 'project_id' ])) {
64
+            $tags[ 'project_id' ]=$record[ 'context' ][ 'project_id' ];
65 65
         }
66 66
 
67
-        if (isset($record['context']['file'])) {
68
-            $tags['file'] = $this->replaceDigitData($record['context']['file']);
67
+        if (isset($record[ 'context' ][ 'file' ])) {
68
+            $tags[ 'file' ]=$this->replaceDigitData($record[ 'context' ][ 'file' ]);
69 69
         }
70 70
 
71
-        if (isset($record['context']['event']['api_stats'][0])) {
72
-            foreach ($record['context']['event']['api_stats'][0] as $k => $v) {
71
+        if (isset($record[ 'context' ][ 'event' ][ 'api_stats' ][ 0 ])) {
72
+            foreach ($record[ 'context' ][ 'event' ][ 'api_stats' ][ 0 ] as $k => $v) {
73 73
                 if (is_string($v) || is_int($v)) {
74
-                    $tags[$k] = $v;
74
+                    $tags[ $k ]=$v;
75 75
                 }
76 76
             }
77 77
         }
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
         if (isset($tags) && count($tags)) {
80 80
             foreach ($tags as $k => $v) {
81 81
                 if (is_numeric($v)) {
82
-                    $message['fields'][$k] = (int) $v;
82
+                    $message[ 'fields' ][ $k ]=(int) $v;
83 83
                 }
84 84
             }
85 85
 
86
-            $message['tags'] = $tags;
86
+            $message[ 'tags' ]=$tags;
87 87
         }
88 88
 
89
-        if (isset($message['fields']['Debug']['message'])) {
90
-            $message['fields']['Debug']['message'] = $this->trimLines($message['fields']['Debug']['message']);
89
+        if (isset($message[ 'fields' ][ 'Debug' ][ 'message' ])) {
90
+            $message[ 'fields' ][ 'Debug' ][ 'message' ]=$this->trimLines($message[ 'fields' ][ 'Debug' ][ 'message' ]);
91 91
         }
92 92
 
93 93
         return $message;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function rfc5424ToSeverity(int $level)
102 102
     {
103
-        $levels = [
103
+        $levels=[
104 104
             100 => 'Debugging',
105 105
             200 => 'Informational',
106 106
             250 => 'Notice',
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             600 => 'Emergency',
112 112
         ];
113 113
 
114
-        $result = isset($levels[$level]) ? $levels[$level] : $levels[600];
114
+        $result=isset($levels[ $level ]) ? $levels[ $level ] : $levels[ 600 ];
115 115
 
116 116
         return $result;
117 117
     }
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
      */
124 124
     private function replaceDigitData(string $string): string
125 125
     {
126
-        $string = preg_replace('~\/[0-9]+~', '/*', $string);
127
-        $string = preg_replace('~\=[0-9]+~', '=*', $string);
126
+        $string=preg_replace('~\/[0-9]+~', '/*', $string);
127
+        $string=preg_replace('~\=[0-9]+~', '=*', $string);
128 128
 
129 129
         return $string;
130 130
     }
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
      */
137 137
     private function trimLines($message): string
138 138
     {
139
-        $limit = config('influxdb.log.limit');
139
+        $limit=config('influxdb.log.limit');
140 140
 
141 141
         if ($limit) {
142
-            $message_array = explode(PHP_EOL, $message);
142
+            $message_array=explode(PHP_EOL, $message);
143 143
 
144 144
             if ($limit < count($message_array)) {
145
-                $message = implode(PHP_EOL, array_slice($message_array, 0, $limit));
145
+                $message=implode(PHP_EOL, array_slice($message_array, 0, $limit));
146 146
             }
147 147
         }
148 148
 
Please login to merge, or discard this patch.
src/Logs/MonologHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      * @param int  $level
24 24
      * @param bool $bubble
25 25
      */
26
-    public function __construct($level = Logger::DEBUG, $bubble = true)
26
+    public function __construct($level=Logger::DEBUG, $bubble=true)
27 27
     {
28 28
         parent::__construct($level, $bubble);
29 29
     }
Please login to merge, or discard this patch.
src/InfluxDbServiceProvider.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
     public function boot(): void
30 30
     {
31 31
         $this->publishes([
32
-                             __DIR__.'/config/influxdb.php' => config_path('influxdb.php'),
33
-                         ]);
32
+                                __DIR__.'/config/influxdb.php' => config_path('influxdb.php'),
33
+                            ]);
34 34
 
35 35
         $this->mergeConfigFrom(__DIR__.'/config/influxdb.php', 'influxdb');
36 36
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
                 }
63 63
 
64 64
                 $dsn = sprintf('%s://%s:%s@%s:%s/%s',
65
-                               $protocol,
66
-                               config('influxdb.user'),
67
-                               config('influxdb.pass'),
68
-                               config('influxdb.host'),
69
-                               config('influxdb.port'),
70
-                               config('influxdb.database')
65
+                                $protocol,
66
+                                config('influxdb.user'),
67
+                                config('influxdb.pass'),
68
+                                config('influxdb.host'),
69
+                                config('influxdb.port'),
70
+                                config('influxdb.database')
71 71
                 );
72 72
 
73 73
                 return InfluxClient::fromDSN($dsn, $timeout, $verifySsl);
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
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
-            $handler = new MonologHandler($this->getLoggingLevel());
38
+            $handler=new MonologHandler($this->getLoggingLevel());
39 39
             $handler->setFormatter(new Formatter());
40 40
 
41
-            $monolog = Log::getMonolog();
41
+            $monolog=Log::getMonolog();
42 42
             $monolog->pushHandler($handler);
43 43
 
44
-            $new_log = new Writer($monolog, Log::getEventDispatcher());
44
+            $new_log=new Writer($monolog, Log::getEventDispatcher());
45 45
             Log::swap($new_log);
46 46
         }
47 47
     }
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
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
-                $timeout = is_int(config('influxdb.timeout', null)) ? config('influxdb.timeout') : 5;
57
-                $verifySsl = is_bool(config('influxdb.verify_ssl', null)) ? config('influxdb.verify_ssl') : true;
58
-                $protocol = 'influxdb';
56
+                $timeout=is_int(config('influxdb.timeout', null)) ? config('influxdb.timeout') : 5;
57
+                $verifySsl=is_bool(config('influxdb.verify_ssl', null)) ? config('influxdb.verify_ssl') : true;
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
-                $dsn = sprintf('%s://%s:%s@%s:%s/%s',
64
+                $dsn=sprintf('%s://%s:%s@%s:%s/%s',
65 65
                                $protocol,
66 66
                                config('influxdb.user'),
67 67
                                config('influxdb.pass'),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
      */
83 83
     private function getLoggingLevel()
84 84
     {
85
-        $level = config('influxdb.log.level', 'DEBUG');
86
-        $level = empty($level) ? 'DEBUG' : $level;
85
+        $level=config('influxdb.log.level', 'DEBUG');
86
+        $level=empty($level) ? 'DEBUG' : $level;
87 87
 
88 88
         return in_array($level, [
89 89
             'DEBUG',
Please login to merge, or discard this patch.
src/InfluxDbFacade.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public static function writePayload(
78 78
         $payload,
79
-        $precision = WritePayload::PRECISION_NANOSECONDS,
80
-        $retentionPolicy = null
79
+        $precision=WritePayload::PRECISION_NANOSECONDS,
80
+        $retentionPolicy=null
81 81
     ): bool {
82 82
         if (config('influxdb.queue.enable', false) === true) {
83 83
             WritePayload::dispatch($payload, $precision, $retentionPolicy);
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public static function writePoints(
100 100
         array $points,
101
-        $precision = WritePoints::PRECISION_NANOSECONDS,
102
-        $retentionPolicy = null
101
+        $precision=WritePoints::PRECISION_NANOSECONDS,
102
+        $retentionPolicy=null
103 103
     ): bool {
104 104
         if (config('influxdb.queue.enable', false) === true) {
105 105
             WritePoints::dispatch($points, $precision, $retentionPolicy);
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  */
8 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
      */
Please login to merge, or discard this patch.
src/Jobs/Write.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @var string|array
21 21
      */
22
-    public $payload = null;
22
+    public $payload=null;
23 23
 
24 24
     /**
25 25
      * @var array
26 26
      */
27
-    public $parameters = null;
27
+    public $parameters=null;
28 28
 
29 29
     /**
30 30
      * Write constructor.
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct(array $parameters, $payload)
36 36
     {
37
-        $this->parameters = $parameters;
38
-        $this->payload = $payload;
37
+        $this->parameters=$parameters;
38
+        $this->payload=$payload;
39 39
 
40 40
         parent::__construct(
41 41
             [
Please login to merge, or discard this patch.
src/Jobs/WritePayload.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,47 +19,47 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @var string PRECISION_NANOSECONDS
21 21
      */
22
-    const PRECISION_NANOSECONDS = 'n';
22
+    const PRECISION_NANOSECONDS='n';
23 23
 
24 24
     /**
25 25
      * @var string PRECISION_MICROSECONDS
26 26
      */
27
-    const PRECISION_MICROSECONDS = 'u';
27
+    const PRECISION_MICROSECONDS='u';
28 28
 
29 29
     /**
30 30
      * @var string PRECISION_MILLISECONDS
31 31
      */
32
-    const PRECISION_MILLISECONDS = 'ms';
32
+    const PRECISION_MILLISECONDS='ms';
33 33
 
34 34
     /**
35 35
      * @var string PRECISION_SECONDS
36 36
      */
37
-    const PRECISION_SECONDS = 's';
37
+    const PRECISION_SECONDS='s';
38 38
 
39 39
     /**
40 40
      * @var string PRECISION_MINUTES
41 41
      */
42
-    const PRECISION_MINUTES = 'm';
42
+    const PRECISION_MINUTES='m';
43 43
 
44 44
     /**
45 45
      * @var string PRECISION_HOURS
46 46
      */
47
-    const PRECISION_HOURS = 'h';
47
+    const PRECISION_HOURS='h';
48 48
 
49 49
     /**
50 50
      * @var string|array
51 51
      */
52
-    public $payload = null;
52
+    public $payload=null;
53 53
 
54 54
     /**
55 55
      * @var string
56 56
      */
57
-    public $precision = null;
57
+    public $precision=null;
58 58
 
59 59
     /**
60 60
      * @var string|null
61 61
      */
62
-    public $retentionPolicy = null;
62
+    public $retentionPolicy=null;
63 63
 
64 64
     /**
65 65
      * WritePayload constructor.
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
      * @param  string       $precision
69 69
      * @param  string|null  $retentionPolicy
70 70
      */
71
-    public function __construct($payload, $precision = self::PRECISION_NANOSECONDS, $retentionPolicy = null)
71
+    public function __construct($payload, $precision=self::PRECISION_NANOSECONDS, $retentionPolicy=null)
72 72
     {
73
-        $this->payload = $payload;
74
-        $this->precision = $precision;
75
-        $this->retentionPolicy = $retentionPolicy;
73
+        $this->payload=$payload;
74
+        $this->precision=$precision;
75
+        $this->retentionPolicy=$retentionPolicy;
76 76
 
77 77
         parent::__construct(
78 78
             [
Please login to merge, or discard this patch.
src/Jobs/WritePoints.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,47 +19,47 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @var string PRECISION_NANOSECONDS
21 21
      */
22
-    const PRECISION_NANOSECONDS = 'n';
22
+    const PRECISION_NANOSECONDS='n';
23 23
 
24 24
     /**
25 25
      * @var string PRECISION_MICROSECONDS
26 26
      */
27
-    const PRECISION_MICROSECONDS = 'u';
27
+    const PRECISION_MICROSECONDS='u';
28 28
 
29 29
     /**
30 30
      * @var string PRECISION_MILLISECONDS
31 31
      */
32
-    const PRECISION_MILLISECONDS = 'ms';
32
+    const PRECISION_MILLISECONDS='ms';
33 33
 
34 34
     /**
35 35
      * @var string PRECISION_SECONDS
36 36
      */
37
-    const PRECISION_SECONDS = 's';
37
+    const PRECISION_SECONDS='s';
38 38
 
39 39
     /**
40 40
      * @var string PRECISION_MINUTES
41 41
      */
42
-    const PRECISION_MINUTES = 'm';
42
+    const PRECISION_MINUTES='m';
43 43
 
44 44
     /**
45 45
      * @var string PRECISION_HOURS
46 46
      */
47
-    const PRECISION_HOURS = 'h';
47
+    const PRECISION_HOURS='h';
48 48
 
49 49
     /**
50 50
      * @var array
51 51
      */
52
-    public $points = null;
52
+    public $points=null;
53 53
 
54 54
     /**
55 55
      * @var string
56 56
      */
57
-    public $precision = null;
57
+    public $precision=null;
58 58
 
59 59
     /**
60 60
      * @var string|null
61 61
      */
62
-    public $retentionPolicy = null;
62
+    public $retentionPolicy=null;
63 63
 
64 64
     /**
65 65
      * WritePoints constructor.
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
      * @param  string            $precision
69 69
      * @param  string|null       $retentionPolicy
70 70
      */
71
-    public function __construct(array $points, $precision = self::PRECISION_NANOSECONDS, $retentionPolicy = null)
71
+    public function __construct(array $points, $precision=self::PRECISION_NANOSECONDS, $retentionPolicy=null)
72 72
     {
73
-        $this->points = $points;
74
-        $this->precision = $precision;
75
-        $this->retentionPolicy = $retentionPolicy;
73
+        $this->points=$points;
74
+        $this->precision=$precision;
75
+        $this->retentionPolicy=$retentionPolicy;
76 76
 
77 77
         parent::__construct(
78 78
             [
Please login to merge, or discard this patch.