Passed
Pull Request — master (#110)
by
unknown
20:01 queued 17:14
created
src/QueryDetectorMiddleware.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
      */
24 24
     public function handle($request, Closure $next)
25 25
     {
26
-        if (! $this->detector->isEnabled()) {
26
+        if (!$this->detector->isEnabled()) {
27 27
             return $next($request);
28 28
         }
29 29
 
Please login to merge, or discard this patch.
src/LumenQueryDetectorServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     public function register()
10 10
     {
11 11
         $this->app->configure('querydetector');
12
-        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'querydetector');
12
+        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'querydetector');
13 13
 
14 14
         $this->app->middleware([
15 15
             QueryDetectorMiddleware::class
Please login to merge, or discard this patch.
src/Outputs/Log.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@
 block discarded – undo
18 18
         $this->log('Detected N+1 Query');
19 19
 
20 20
         foreach ($detectedQueries as $detectedQuery) {
21
-            $logOutput = 'Model: '.$detectedQuery['model'] . PHP_EOL;
21
+            $logOutput = 'Model: '.$detectedQuery['model'].PHP_EOL;
22 22
 
23
-            $logOutput .= 'Relation: '.$detectedQuery['relation'] . PHP_EOL;
23
+            $logOutput .= 'Relation: '.$detectedQuery['relation'].PHP_EOL;
24 24
 
25
-            $logOutput .= 'Num-Called: '.$detectedQuery['count'] . PHP_EOL;
25
+            $logOutput .= 'Num-Called: '.$detectedQuery['count'].PHP_EOL;
26 26
 
27
-            $logOutput .= 'Call-Stack:' . PHP_EOL;
27
+            $logOutput .= 'Call-Stack:'.PHP_EOL;
28 28
 
29 29
             foreach ($detectedQuery['sources'] as $source) {
30
-                $logOutput .= '#'.$source->index.' '.$source->name.':'.$source->line . PHP_EOL;
30
+                $logOutput .= '#'.$source->index.' '.$source->name.':'.$source->line.PHP_EOL;
31 31
             }
32 32
 
33 33
             $this->log($logOutput);
Please login to merge, or discard this patch.
src/Outputs/Alert.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@
 block discarded – undo
25 25
         $pos = strripos($content, '</body>');
26 26
 
27 27
         if (false !== $pos) {
28
-            $content = substr($content, 0, $pos) . $outputContent . substr($content, $pos);
28
+            $content = substr($content, 0, $pos).$outputContent.substr($content, $pos);
29 29
         } else {
30
-            $content = $content . $outputContent;
30
+            $content = $content.$outputContent;
31 31
         }
32 32
 
33 33
         // Update the new content and reset the content length
Please login to merge, or discard this patch.
src/Outputs/Json.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     {
17 17
         if ($response instanceof JsonResponse) {
18 18
             $data = $response->getData(true);
19
-            if (! is_array($data)){
20
-                $data = [ $data ];
19
+            if (!is_array($data)) {
20
+                $data = [$data ];
21 21
             }
22 22
             
23 23
             $data['warning_queries'] = $detectedQueries;
Please login to merge, or discard this patch.
src/Outputs/Console.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@
 block discarded – undo
25 25
         $pos = strripos($content, '</body>');
26 26
 
27 27
         if (false !== $pos) {
28
-            $content = substr($content, 0, $pos) . $outputContent . substr($content, $pos);
28
+            $content = substr($content, 0, $pos).$outputContent.substr($content, $pos);
29 29
         } else {
30
-            $content = $content . $outputContent;
30
+            $content = $content.$outputContent;
31 31
         }
32 32
 
33 33
         // Update the new content and reset the content length
Please login to merge, or discard this patch.
src/QueryDetector.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             return;
37 37
         }
38 38
 
39
-        DB::listen(function ($query) {
39
+        DB::listen(function($query) {
40 40
             $backtrace = collect(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 50));
41 41
 
42 42
             $this->logQuery($query, $backtrace);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function logQuery($query, Collection $backtrace)
65 65
     {
66
-        $modelTrace = $backtrace->first(function ($trace) {
66
+        $modelTrace = $backtrace->first(function($trace) {
67 67
             return Arr::get($trace, 'object') instanceof Builder;
68 68
         });
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
              * Relations get resolved by either calling the "getRelationValue" method on the model,
74 74
              * or if the class itself is a Relation.
75 75
              */
76
-            $relation = $backtrace->first(function ($trace) {
76
+            $relation = $backtrace->first(function($trace) {
77 77
                 return Arr::get($trace, 'function') === 'getRelationValue' || Arr::get($trace, 'class') === Relation::class;
78 78
             });
79 79
 
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
                     return;
96 96
                 }
97 97
 
98
-                $key = md5($query->sql . $model . $relationName . $sources[0]->name . $sources[0]->line);
98
+                $key = md5($query->sql.$model.$relationName.$sources[0]->name.$sources[0]->line);
99 99
 
100
-                $count = Arr::get($this->queries, $key . '.count', 0);
101
-                $time = Arr::get($this->queries, $key . '.time', 0);
100
+                $count = Arr::get($this->queries, $key.'.count', 0);
101
+                $time = Arr::get($this->queries, $key.'.time', 0);
102 102
 
103 103
                 $this->queries[$key] = [
104 104
                     'count' => ++$count,
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function parseTrace($index, array $trace)
128 128
     {
129
-        $frame = (object)[
129
+        $frame = (object) [
130 130
             'index' => $index,
131 131
             'name' => null,
132 132
             'line' => isset($trace['line']) ? $trace['line'] : '?',
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
         foreach ($exceptions as $parentModel => $relations) {
194 194
             foreach ($relations as $relation) {
195
-                $queries = $queries->reject(function ($query) use ($relation, $parentModel) {
195
+                $queries = $queries->reject(function($query) use ($relation, $parentModel) {
196 196
                     return $query['model'] === $parentModel && $query['relatedModel'] === $relation;
197 197
                 });
198 198
             }
Please login to merge, or discard this patch.