@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | if ($userAgent) { |
| 162 | 162 | $parser = new Parser($userAgent); |
| 163 | 163 | $sample->device = $parser->device->model; |
| 164 | - $sample->browser = $parser->browser->name . ' ' . $parser->browser->getVersion(); |
|
| 165 | - $sample->os = $parser->os->name . ' ' . $parser->os->getVersion(); |
|
| 164 | + $sample->browser = $parser->browser->name.' '.$parser->browser->getVersion(); |
|
| 165 | + $sample->os = $parser->os->name.' '.$parser->os->getVersion(); |
|
| 166 | 166 | $sample->mobile = $parser->isMobile(); |
| 167 | 167 | } |
| 168 | 168 | // Save the data sample |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $now = round(microtime(true) * 1000); |
| 188 | 188 | $cache = Craft::$app->getCache(); |
| 189 | 189 | $then = $cache->get(self::LAST_BEACON_CACHE_KEY); |
| 190 | - if (($then !== false) && ($now - (int)$then < Webperf::$settings->rateLimitMs)) { |
|
| 190 | + if (($then !== false) && ($now - (int) $then < Webperf::$settings->rateLimitMs)) { |
|
| 191 | 191 | $limited = true; |
| 192 | 192 | Craft::warning('Beacon ignored due to rate limiting', __METHOD__); |
| 193 | 193 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 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 |
||
| 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 | ]); |
@@ -92,8 +92,8 @@ |
||
| 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) { |