@@ -51,7 +51,7 @@ |
||
| 51 | 51 | self::$config['server']['publicPath'] = $baseAssetsUrl; |
| 52 | 52 | $useDevServer = getenv('NYS_PLUGIN_DEVSERVER'); |
| 53 | 53 | if ($useDevServer !== false) { |
| 54 | - self::$config['useDevServer'] = (bool)$useDevServer; |
|
| 54 | + self::$config['useDevServer'] = (bool) $useDevServer; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $cache = Craft::$app->getCache(); |
| 406 | 406 | $file = $cache->getOrSet( |
| 407 | 407 | self::CACHE_KEY.$path, |
| 408 | - function () use ($path, $callback) { |
|
| 408 | + function() use ($path, $callback) { |
|
| 409 | 409 | $result = null; |
| 410 | 410 | $contents = @file_get_contents($path); |
| 411 | 411 | if ($contents) { |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | protected static function combinePaths(string ...$paths): string |
| 436 | 436 | { |
| 437 | 437 | $last_key = \count($paths) - 1; |
| 438 | - array_walk($paths, function (&$val, $key) use ($last_key) { |
|
| 438 | + array_walk($paths, function(&$val, $key) use ($last_key) { |
|
| 439 | 439 | switch ($key) { |
| 440 | 440 | case 0: |
| 441 | 441 | $val = rtrim($val, '/ '); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | namespace { |
| 12 | 12 | |
| 13 | - require_once __DIR__ . '/../lib/geoiploc.php'; |
|
| 13 | + require_once __DIR__.'/../lib/geoiploc.php'; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | namespace nystudio107\webperf\controllers { |
@@ -42,7 +42,7 @@ discard block |
||
| 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 |
||
| 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; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } else { |
| 113 | 113 | $variables['sitesMenuLabel'] = Craft::t( |
| 114 | 114 | 'site', |
| 115 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
| 115 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
| 116 | 116 | ); |
| 117 | 117 | } |
| 118 | 118 | } else { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if (($parsed = parse_url(self::getBaseUrl($site))) === false) { |
| 175 | - Craft::warning('Unable to parse the site base URL: ' . $site->baseUrl); |
|
| 175 | + Craft::warning('Unable to parse the site base URL: '.$site->baseUrl); |
|
| 176 | 176 | continue; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | // Does the site URL specify a base path? |
| 185 | 185 | $parsedPath = !empty($parsed['path']) ? self::normalizePath($parsed['path']) : ''; |
| 186 | - if ($parsedPath && strpos($fullUri . '/', $parsedPath . '/') !== 0) { |
|
| 186 | + if ($parsedPath && strpos($fullUri.'/', $parsedPath.'/') !== 0) { |
|
| 187 | 187 | continue; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | protected static function getBaseUrl(Site $site): string |
| 258 | 258 | { |
| 259 | 259 | if ($site->baseUrl) { |
| 260 | - return rtrim(self::parseEnv($site->baseUrl), '/') . '/'; |
|
| 260 | + return rtrim(self::parseEnv($site->baseUrl), '/').'/'; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | return null; |
@@ -87,8 +87,8 @@ |
||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | $this->stats[$cat]['count']++; |
| 90 | - $this->stats[$cat]['duration'] += (float)$timing['duration'] * 1000; |
|
| 91 | - $this->stats[$cat]['memory'] += (int)$timing['memoryDiff']; |
|
| 90 | + $this->stats[$cat]['duration'] += (float) $timing['duration'] * 1000; |
|
| 91 | + $this->stats[$cat]['memory'] += (int) $timing['memoryDiff']; |
|
| 92 | 92 | } |
| 93 | 93 | if ($final) { |
| 94 | 94 | $this->export(); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | Event::on( |
| 205 | 205 | Plugins::class, |
| 206 | 206 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
| 207 | - function (PluginEvent $event) { |
|
| 207 | + function(PluginEvent $event) { |
|
| 208 | 208 | if ($event->plugin === $this) { |
| 209 | 209 | // Invalidate our caches after we've been installed |
| 210 | 210 | $this->clearAllCaches(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | Event::on( |
| 233 | 233 | CraftVariable::class, |
| 234 | 234 | CraftVariable::EVENT_INIT, |
| 235 | - function (Event $event) { |
|
| 235 | + function(Event $event) { |
|
| 236 | 236 | /** @var CraftVariable $variable */ |
| 237 | 237 | $variable = $event->sender; |
| 238 | 238 | $variable->set('webperf', WebperfVariable::class); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | Event::on( |
| 243 | 243 | Plugins::class, |
| 244 | 244 | Plugins::EVENT_AFTER_LOAD_PLUGINS, |
| 245 | - function () { |
|
| 245 | + function() { |
|
| 246 | 246 | // Install these only after all other plugins have loaded |
| 247 | 247 | $request = Craft::$app->getRequest(); |
| 248 | 248 | // Only respond to non-console site requests |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | Event::on( |
| 267 | 267 | UrlManager::class, |
| 268 | 268 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 269 | - function (RegisterUrlRulesEvent $event) { |
|
| 269 | + function(RegisterUrlRulesEvent $event) { |
|
| 270 | 270 | Craft::debug( |
| 271 | 271 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
| 272 | 272 | __METHOD__ |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | Event::on( |
| 290 | 290 | UrlManager::class, |
| 291 | 291 | UrlManager::EVENT_REGISTER_CP_URL_RULES, |
| 292 | - function (RegisterUrlRulesEvent $event) { |
|
| 292 | + function(RegisterUrlRulesEvent $event) { |
|
| 293 | 293 | Craft::debug( |
| 294 | 294 | 'UrlManager::EVENT_REGISTER_CP_URL_RULES', |
| 295 | 295 | __METHOD__ |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | Event::on( |
| 306 | 306 | Dashboard::class, |
| 307 | 307 | Dashboard::EVENT_REGISTER_WIDGET_TYPES, |
| 308 | - function (RegisterComponentTypesEvent $event) { |
|
| 308 | + function(RegisterComponentTypesEvent $event) { |
|
| 309 | 309 | $event->types[] = MetricsWidget::class; |
| 310 | 310 | } |
| 311 | 311 | ); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | Event::on( |
| 314 | 314 | UserPermissions::class, |
| 315 | 315 | UserPermissions::EVENT_REGISTER_PERMISSIONS, |
| 316 | - function (RegisterUserPermissionsEvent $event) { |
|
| 316 | + function(RegisterUserPermissionsEvent $event) { |
|
| 317 | 317 | Craft::debug( |
| 318 | 318 | 'UserPermissions::EVENT_REGISTER_PERMISSIONS', |
| 319 | 319 | __METHOD__ |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | Event::on( |
| 339 | 339 | View::class, |
| 340 | 340 | View::EVENT_END_PAGE, |
| 341 | - function () { |
|
| 341 | + function() { |
|
| 342 | 342 | Craft::debug( |
| 343 | 343 | 'View::EVENT_END_PAGE', |
| 344 | 344 | __METHOD__ |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | Event::on( |
| 363 | 363 | View::class, |
| 364 | 364 | View::EVENT_END_BODY, |
| 365 | - function () { |
|
| 365 | + function() { |
|
| 366 | 366 | Craft::debug( |
| 367 | 367 | 'View::EVENT_END_BODY', |
| 368 | 368 | __METHOD__ |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | Event::on( |
| 386 | 386 | Application::class, |
| 387 | 387 | Application::EVENT_AFTER_REQUEST, |
| 388 | - function () { |
|
| 388 | + function() { |
|
| 389 | 389 | Craft::debug( |
| 390 | 390 | 'Application::EVENT_AFTER_REQUEST', |
| 391 | 391 | __METHOD__ |
@@ -73,7 +73,7 @@ |
||
| 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); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | ->from(['{{%webperf_data_samples}}']) |
| 41 | 41 | ->where(['not', [$column => null]]) |
| 42 | 42 | ; |
| 43 | - if ((int)$siteId !== 0) { |
|
| 43 | + if ((int) $siteId !== 0) { |
|
| 44 | 44 | $query->andWhere(['siteId' => $siteId]); |
| 45 | 45 | } |
| 46 | 46 | return $query->count(); |