Passed
Branch v1 (eb0178)
by Andrew
08:09
created
src/helpers/Text.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         if (!empty($string)) {
44 44
             $string = strip_tags($string);
45
-            $result = (string)Stringy::create($string)->truncate($length, $substring);
45
+            $result = (string) Stringy::create($string)->truncate($length, $substring);
46 46
         }
47 47
 
48 48
         return $result;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         if (!empty($string)) {
68 68
             $string = strip_tags($string);
69
-            $result = (string)Stringy::create($string)->safeTruncate($length, $substring);
69
+            $result = (string) Stringy::create($string)->safeTruncate($length, $substring);
70 70
         }
71 71
 
72 72
         return $result;
Please login to merge, or discard this patch.
src/helpers/PluginTemplate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 
74 74
         // Render the template with our vars passed in
75 75
         try {
76
-            $htmlText = Craft::$app->view->renderTemplate('webperf/' . $templatePath, $params);
76
+            $htmlText = Craft::$app->view->renderTemplate('webperf/'.$templatePath, $params);
77 77
             if ($minifier) {
78 78
                 // If SEOmatic is installed, get the title from it
79 79
                 $minify = Craft::$app->getPlugins()->getPlugin(self::MINIFY_PLUGIN_HANDLE);
Please login to merge, or discard this patch.
src/controllers/TablesController.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
             // Compute the largest page load time
125 125
             $maxTotalPageLoad = 0;
126 126
             foreach ($stats as &$stat) {
127
-             // Determine the stat type
127
+                // Determine the stat type
128 128
                 if (!empty($stat['pageLoad']) && !empty($stat['craftTotalMs'])) {
129 129
                     $stat['type'] = 'both';
130 130
                 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             ->offset($offset)
105 105
             ->where(['between', 'dateCreated', $start, $end])
106 106
         ;
107
-        if ((int)$siteId !== 0) {
107
+        if ((int) $siteId !== 0) {
108 108
             $query->andWhere(['siteId' => $siteId]);
109 109
         }
110 110
         if ($filter !== '') {
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
             $index = 1;
144 144
             foreach ($stats as &$stat) {
145 145
                 $stat['id'] = $index++;
146
-                $stat['cnt'] = (int)$stat['cnt'];
147
-                $stat['maxTotalPageLoad'] = (int)$maxTotalPageLoad;
146
+                $stat['cnt'] = (int) $stat['cnt'];
147
+                $stat['maxTotalPageLoad'] = (int) $maxTotalPageLoad;
148 148
                 // Decode any emojis in the title
149 149
                 if (!empty($stat['title'])) {
150 150
                     $stat['title'] = html_entity_decode($stat['title'], ENT_NOQUOTES, 'UTF-8');
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             ->where(['url' => $pageUrl])
243 243
             ->andWhere(['between', 'dateCreated', $start, $end])
244 244
         ;
245
-        if ((int)$siteId !== 0) {
245
+        if ((int) $siteId !== 0) {
246 246
             $query->andWhere(['siteId' => $siteId]);
247 247
         }
248 248
         if ($filter !== '') {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                     $stat['type'] = 'frontend';
275 275
                 }
276 276
                 if ($stat['pageLoad'] > $maxTotalPageLoad) {
277
-                    $maxTotalPageLoad = (int)$stat['pageLoad'];
277
+                    $maxTotalPageLoad = (int) $stat['pageLoad'];
278 278
                 }
279 279
             }
280 280
             // Massage the stats
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
                     $date = DateTimeHelper::toDateTime($stats['dateCreated']);
284 284
                     $stats['dateCreated'] = $date->format('Y-m-d H:i:s');
285 285
                 }
286
-                $stat['mobile'] = (bool)$stat['mobile'];
287
-                $stat['maxTotalPageLoad'] = (int)$maxTotalPageLoad;
286
+                $stat['mobile'] = (bool) $stat['mobile'];
287
+                $stat['maxTotalPageLoad'] = (int) $maxTotalPageLoad;
288 288
                 // Decode any emojis in the title
289 289
                 if (!empty($stat['title'])) {
290 290
                     $stat['title'] = html_entity_decode($stat['title'], ENT_NOQUOTES, 'UTF-8');
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                     'SUM(case when [[type]] = \'boomerang\' then 1 else 0 end) as [[boomerangCount]]',
397 397
                 ]);
398 398
         }
399
-        if ((int)$siteId !== 0) {
399
+        if ((int) $siteId !== 0) {
400 400
             $query->andWhere(['siteId' => $siteId]);
401 401
         }
402 402
         if ($filter !== '') {
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
             $user = Craft::$app->getUser()->getIdentity();
418 418
             // Massage the stats
419 419
             foreach ($stats as &$stat) {
420
-                $stat['cnt'] = (int)$stat['cnt'];
421
-                $stat['craftCount'] = (int)$stat['craftCount'];
422
-                $stat['boomerangCount'] = (int)$stat['boomerangCount'];
420
+                $stat['cnt'] = (int) $stat['cnt'];
421
+                $stat['craftCount'] = (int) $stat['craftCount'];
422
+                $stat['boomerangCount'] = (int) $stat['boomerangCount'];
423 423
                 // Decode any emojis in the title
424 424
                 if (!empty($stat['title'])) {
425 425
                     $stat['title'] = html_entity_decode($stat['title'], ENT_NOQUOTES, 'UTF-8');
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
             ->andWhere(['between', '[[webperf_error_samples.dateCreated]]', $start, $end])
537 537
             ->leftJoin('{{%webperf_data_samples}} webperf_data_samples', '[[webperf_data_samples.requestId]] = [[webperf_error_samples.requestId]]')
538 538
         ;
539
-        if ((int)$siteId !== 0) {
539
+        if ((int) $siteId !== 0) {
540 540
             $query->andWhere(['siteId' => $siteId]);
541 541
         }
542 542
         if ($filter !== '') {
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                     $stats['dateCreated'] = $date->format('Y-m-d H:i:s');
565 565
                 }
566 566
                 if (isset($stat['mobile'])) {
567
-                    $stat['mobile'] = (bool)$stat['mobile'];
567
+                    $stat['mobile'] = (bool) $stat['mobile'];
568 568
                 }
569 569
                 // Decode any emojis in the title
570 570
                 if (!empty($stat['title'])) {
Please login to merge, or discard this patch.
src/services/Beacons.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         }
153 153
         $stats = Webperf::$plugin->profileTarget->stats;
154 154
         $request = Craft::$app->getRequest();
155
-        $pageLoad = (int)($stats['database']['duration']
155
+        $pageLoad = (int) ($stats['database']['duration']
156 156
             + $stats['twig']['duration']
157 157
             + $stats['other']['duration']);
158 158
         // Allocate a new DataSample, and fill it in
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
             'queryString' => $request->getQueryString(),
163 163
             'pageLoad' => $pageLoad,
164 164
             'craftTotalMs' => $pageLoad,
165
-            'craftDbMs' => (int)$stats['database']['duration'],
166
-            'craftDbCnt' => (int)$stats['database']['count'],
167
-            'craftTwigMs' => (int)$stats['twig']['duration'],
168
-            'craftTwigCnt' => (int)$stats['twig']['count'],
169
-            'craftOtherMs' => (int)$stats['other']['duration'],
170
-            'craftOtherCnt' => (int)$stats['other']['count'],
171
-            'craftTotalMemory' => (int)($stats['database']['memory']
165
+            'craftDbMs' => (int) $stats['database']['duration'],
166
+            'craftDbCnt' => (int) $stats['database']['count'],
167
+            'craftTwigMs' => (int) $stats['twig']['duration'],
168
+            'craftTwigCnt' => (int) $stats['twig']['count'],
169
+            'craftOtherMs' => (int) $stats['other']['duration'],
170
+            'craftOtherCnt' => (int) $stats['other']['count'],
171
+            'craftTotalMemory' => (int) ($stats['database']['memory']
172 172
                 + $stats['twig']['memory']
173 173
                 + $stats['other']['memory']),
174 174
         ]);
Please login to merge, or discard this patch.
src/log/ProfileTarget.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,8 @@
 block discarded – undo
92 92
                 }
93 93
             }
94 94
             $this->stats[$cat]['count']++;
95
-            $this->stats[$cat]['duration'] += (float)$timing['duration'] * 1000;
96
-            $this->stats[$cat]['memory'] += (int)$timing['memoryDiff'];
95
+            $this->stats[$cat]['duration'] += (float) $timing['duration'] * 1000;
96
+            $this->stats[$cat]['memory'] += (int) $timing['memoryDiff'];
97 97
         }
98 98
         $this->stats['memory'] = memory_get_peak_usage(true);
99 99
         if ($final) {
Please login to merge, or discard this patch.
src/services/Recommendations.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
         if (!empty($pageUrl)) {
108 108
             $query->andWhere(['url' => $pageUrl]);
109 109
         }
110
-        if ((int)$siteId !== 0) {
110
+        if ((int) $siteId !== 0) {
111 111
             $query->andWhere(['siteId' => $siteId]);
112 112
         }
113 113
         $stats = $query->all();
Please login to merge, or discard this patch.
src/base/Recommendation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,6 +45,6 @@
 block discarded – undo
45 45
      */
46 46
     public function displayMs(int $number): string
47 47
     {
48
-        return number_format((float)$number / 1000, 2).'s';
48
+        return number_format((float) $number / 1000, 2).'s';
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
src/controllers/ChartsController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             ])
82 82
             ->where(['between', 'dateCreated', $start, $end])
83 83
             ->andWhere(['not', [$column => null]]);
84
-        if ((int)$siteId !== 0) {
84
+        if ((int) $siteId !== 0) {
85 85
             $query->andWhere(['siteId' => $siteId]);
86 86
         }
87 87
         if ($pageUrl !== '') {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         // Massage the data
92 92
         if ($stats) {
93 93
             foreach ($stats as &$stat) {
94
-                $stat['cnt'] = (int)$stat['cnt'];
94
+                $stat['cnt'] = (int) $stat['cnt'];
95 95
             }
96 96
             $data = $stats[0];
97 97
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             ])
137 137
             ->where(['between', 'dateCreated', $start, $end])
138 138
             ->andWhere(['not', [$column => null]]);
139
-        if ((int)$siteId !== 0) {
139
+        if ((int) $siteId !== 0) {
140 140
             $query->andWhere(['siteId' => $siteId]);
141 141
         }
142 142
         $query
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         // Massage the data
148 148
         if ($stats) {
149 149
             foreach ($stats as &$stat) {
150
-                $stat['cnt'] = (int)$stat['cnt'];
150
+                $stat['cnt'] = (int) $stat['cnt'];
151 151
                 $stat['detailPageUrl'] = UrlHelper::cpUrl('webperf/performance/page-detail', [
152 152
                     'pageUrl' => $stat['url'],
153 153
                     'siteId' => $siteId,
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             ])
219 219
             ->where(['between', 'dateCreated', $start, $end])
220 220
             ;
221
-        if ((int)$siteId !== 0) {
221
+        if ((int) $siteId !== 0) {
222 222
             $query->andWhere(['siteId' => $siteId]);
223 223
         }
224 224
         if ($pageUrl !== '') {
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             ])
348 348
             ->where(['between', 'dateCreated', $start, $end])
349 349
         ;
350
-        if ((int)$siteId !== 0) {
350
+        if ((int) $siteId !== 0) {
351 351
             $query->andWhere(['siteId' => $siteId]);
352 352
         }
353 353
         if ($pageUrl !== '') {
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
                 $craftErrors['labels'][$index] = $stat['sampleDate'];
392 392
                 switch ($stat['type']) {
393 393
                     case 'boomerang':
394
-                        $boomerangErrors['data'][$index] = (int)$stat['cnt'];
394
+                        $boomerangErrors['data'][$index] = (int) $stat['cnt'];
395 395
                         $boomerangErrors['labels'][$index] = $stat['sampleDate'];
396 396
                         break;
397 397
                     case 'craft':
398
-                        $craftErrors['data'][$index] = (int)$stat['cnt'];
398
+                        $craftErrors['data'][$index] = (int) $stat['cnt'];
399 399
                         $craftErrors['labels'][$index] = $stat['sampleDate'];
400 400
                         break;
401 401
                 }
Please login to merge, or discard this patch.
src/recommendations/MemoryLimit.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function evaluate()
37 37
     {
38
-        $phpMemoryLimit = (int)$this->memoryLimit();
39
-        $this->sample->craftTotalMemory = (int)$this->sample->craftTotalMemory;
38
+        $phpMemoryLimit = (int) $this->memoryLimit();
39
+        $this->sample->craftTotalMemory = (int) $this->sample->craftTotalMemory;
40 40
         if ($phpMemoryLimit && $this->sample->craftTotalMemory) {
41 41
             $ratio = $phpMemoryLimit / $this->sample->craftTotalMemory;
42
-            $displayCraftTotalMemory = (($this->sample->craftTotalMemory / 1024) / 1024) . 'M';
43
-            $displayPhpMemoryLimit = (($phpMemoryLimit / 1024) / 1024) . 'M';
44
-            $displayCraftMinMemory = ((self::MIN_CRAFT_MEMORY / 1024) / 1024) . 'M';
45
-            $displayCraftMaxMemory = ((self::MAX_CRAFT_MEMORY / 1024) / 1024) . 'M';
42
+            $displayCraftTotalMemory = (($this->sample->craftTotalMemory / 1024) / 1024).'M';
43
+            $displayPhpMemoryLimit = (($phpMemoryLimit / 1024) / 1024).'M';
44
+            $displayCraftMinMemory = ((self::MIN_CRAFT_MEMORY / 1024) / 1024).'M';
45
+            $displayCraftMaxMemory = ((self::MAX_CRAFT_MEMORY / 1024) / 1024).'M';
46 46
             $this->summary = Craft::t(
47 47
                 'webperf',
48 48
                 'Check the `memory_limit` setting in your `php.ini` file',
@@ -114,6 +114,6 @@  discard block
 block discarded – undo
114 114
             }
115 115
         }
116 116
 
117
-        return (int)$memoryLimit;
117
+        return (int) $memoryLimit;
118 118
     }
119 119
 }
Please login to merge, or discard this patch.