@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | foreach ($config as $propName => $propValue) { |
| 38 | 38 | if (!property_exists($class, $propName)) { |
| 39 | - unset($config[$propName]); |
|
| 39 | + unset($config[ $propName ]); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * @inheritdoc |
| 49 | 49 | */ |
| 50 | - public function __construct(array $config = []) |
|
| 50 | + public function __construct(array $config = [ ]) |
|
| 51 | 51 | { |
| 52 | 52 | // Unset any deprecated properties |
| 53 | 53 | self::cleanProperties(static::class, $config); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | if (!empty($string)) { |
| 45 | 45 | $string = strip_tags($string); |
| 46 | - $result = (string)Stringy::create($string)->truncate($length, $substring); |
|
| 46 | + $result = (string) Stringy::create($string)->truncate($length, $substring); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $result; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if (!empty($string)) { |
| 69 | 69 | $string = strip_tags($string); |
| 70 | - $result = (string)Stringy::create($string)->safeTruncate($length, $substring); |
|
| 70 | + $result = (string) Stringy::create($string)->safeTruncate($length, $substring); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return $result; |
@@ -78,8 +78,8 @@ |
||
| 78 | 78 | $rules = array_merge( |
| 79 | 79 | $rules, |
| 80 | 80 | [ |
| 81 | - ['numberOfDays', 'integer', 'min' => 1], |
|
| 82 | - ['numberOfDays', 'default', 'value' => 30], |
|
| 81 | + [ 'numberOfDays', 'integer', 'min' => 1 ], |
|
| 82 | + [ 'numberOfDays', 'default', 'value' => 30 ], |
|
| 83 | 83 | ] |
| 84 | 84 | ); |
| 85 | 85 | return $rules; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | // Protected Properties |
| 40 | 40 | // ========================================================================= |
| 41 | 41 | |
| 42 | - protected $allowAnonymous = []; |
|
| 42 | + protected $allowAnonymous = [ ]; |
|
| 43 | 43 | |
| 44 | 44 | // Public Methods |
| 45 | 45 | // ========================================================================= |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function actionPluginSettings($settings = null): Response |
| 56 | 56 | { |
| 57 | - $variables = []; |
|
| 57 | + $variables = [ ]; |
|
| 58 | 58 | PermissionHelper::controllerPermissionCheck('retour:settings'); |
| 59 | 59 | if ($settings === null) { |
| 60 | 60 | $settings = Retour::$settings; |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | } catch (InvalidConfigException $e) { |
| 70 | 70 | Craft::error($e->getMessage(), __METHOD__); |
| 71 | 71 | } |
| 72 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 72 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 73 | 73 | '@nystudio107/retour/assetbundles/retour/dist', |
| 74 | 74 | true |
| 75 | 75 | ); |
| 76 | 76 | // Basic variables |
| 77 | - $variables['fullPageForm'] = true; |
|
| 78 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 79 | - $variables['pluginName'] = $pluginName; |
|
| 80 | - $variables['title'] = $templateTitle; |
|
| 81 | - $variables['crumbs'] = [ |
|
| 77 | + $variables[ 'fullPageForm' ] = true; |
|
| 78 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 79 | + $variables[ 'pluginName' ] = $pluginName; |
|
| 80 | + $variables[ 'title' ] = $templateTitle; |
|
| 81 | + $variables[ 'crumbs' ] = [ |
|
| 82 | 82 | [ |
| 83 | 83 | 'label' => $pluginName, |
| 84 | 84 | 'url' => UrlHelper::cpUrl('retour'), |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | 'url' => UrlHelper::cpUrl('retour/settings'), |
| 89 | 89 | ], |
| 90 | 90 | ]; |
| 91 | - $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
|
| 92 | - $variables['selectedSubnavItem'] = 'settings'; |
|
| 93 | - $variables['settings'] = $settings; |
|
| 91 | + $variables[ 'docTitle' ] = "{$pluginName} - {$templateTitle}"; |
|
| 92 | + $variables[ 'selectedSubnavItem' ] = 'settings'; |
|
| 93 | + $variables[ 'settings' ] = $settings; |
|
| 94 | 94 | |
| 95 | 95 | // Render the template |
| 96 | 96 | return $this->renderTemplate('retour/settings', $variables); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | PermissionHelper::controllerPermissionCheck('retour:settings'); |
| 111 | 111 | $this->requirePostRequest(); |
| 112 | 112 | $pluginHandle = Craft::$app->getRequest()->getRequiredBodyParam('pluginHandle'); |
| 113 | - $settings = Craft::$app->getRequest()->getBodyParam('settings', []); |
|
| 113 | + $settings = Craft::$app->getRequest()->getBodyParam('settings', [ ]); |
|
| 114 | 114 | $plugin = Craft::$app->getPlugins()->getPlugin($pluginHandle); |
| 115 | 115 | |
| 116 | 116 | if ($plugin === null) { |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | // Make sure there is a leading / |
| 62 | - $value = '/'.ltrim($value, '/'); |
|
| 62 | + $value = '/' . ltrim($value, '/'); |
|
| 63 | 63 | $model->$attribute = $value; |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @var array The URIs for the element before it was saved |
| 91 | 91 | */ |
| 92 | - public $oldElementUris = []; |
|
| 92 | + public $oldElementUris = [ ]; |
|
| 93 | 93 | |
| 94 | 94 | // Public Methods |
| 95 | 95 | // ========================================================================= |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | Craft::t( |
| 115 | 115 | 'retour', |
| 116 | 116 | '{name} plugin loaded', |
| 117 | - ['name' => $this->name] |
|
| 117 | + [ 'name' => $this->name ] |
|
| 118 | 118 | ), |
| 119 | 119 | __METHOD__ |
| 120 | 120 | ); |
@@ -134,24 +134,24 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function getCpNavItem() |
| 136 | 136 | { |
| 137 | - $subNavs = []; |
|
| 137 | + $subNavs = [ ]; |
|
| 138 | 138 | $navItem = parent::getCpNavItem(); |
| 139 | 139 | $currentUser = Craft::$app->getUser()->getIdentity(); |
| 140 | 140 | // Only show sub-navs the user has permission to view |
| 141 | 141 | if ($currentUser->can('retour:dashboard')) { |
| 142 | - $subNavs['dashboard'] = [ |
|
| 142 | + $subNavs[ 'dashboard' ] = [ |
|
| 143 | 143 | 'label' => 'Dashboard', |
| 144 | 144 | 'url' => 'retour/dashboard', |
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | if ($currentUser->can('retour:redirects')) { |
| 148 | - $subNavs['redirects'] = [ |
|
| 148 | + $subNavs[ 'redirects' ] = [ |
|
| 149 | 149 | 'label' => 'Redirects', |
| 150 | 150 | 'url' => 'retour/redirects', |
| 151 | 151 | ]; |
| 152 | 152 | } |
| 153 | 153 | if ($currentUser->can('retour:settings')) { |
| 154 | - $subNavs['settings'] = [ |
|
| 154 | + $subNavs[ 'settings' ] = [ |
|
| 155 | 155 | 'label' => 'Settings', |
| 156 | 156 | 'url' => 'retour/settings', |
| 157 | 157 | ]; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | Event::on( |
| 211 | 211 | Plugins::class, |
| 212 | 212 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
| 213 | - function (PluginEvent $event) { |
|
| 213 | + function(PluginEvent $event) { |
|
| 214 | 214 | if ($event->plugin === $this) { |
| 215 | 215 | // Invalidate our caches after we've been installed |
| 216 | 216 | $this->clearAllCaches(); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | Event::on( |
| 238 | 238 | CraftVariable::class, |
| 239 | 239 | CraftVariable::EVENT_INIT, |
| 240 | - function (Event $event) { |
|
| 240 | + function(Event $event) { |
|
| 241 | 241 | /** @var CraftVariable $variable */ |
| 242 | 242 | $variable = $event->sender; |
| 243 | 243 | $variable->set('retour', RetourVariable::class); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | Event::on( |
| 248 | 248 | Elements::class, |
| 249 | 249 | Elements::EVENT_BEFORE_SAVE_ELEMENT, |
| 250 | - function (ElementEvent $event) { |
|
| 250 | + function(ElementEvent $event) { |
|
| 251 | 251 | Craft::debug( |
| 252 | 252 | 'Elements::EVENT_BEFORE_SAVE_ELEMENT', |
| 253 | 253 | __METHOD__ |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | if ($oldElement !== null) { |
| 263 | 263 | // Stash the old URLs by element id, and do so only once, |
| 264 | 264 | // in case we are called more than once per request |
| 265 | - if (empty($this->oldElementUris[$oldElement->id])) { |
|
| 266 | - $this->oldElementUris[$oldElement->id] = $this->getAllElementUris($oldElement); |
|
| 265 | + if (empty($this->oldElementUris[ $oldElement->id ])) { |
|
| 266 | + $this->oldElementUris[ $oldElement->id ] = $this->getAllElementUris($oldElement); |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | Event::on( |
| 275 | 275 | Elements::class, |
| 276 | 276 | Elements::EVENT_AFTER_SAVE_ELEMENT, |
| 277 | - function (ElementEvent $event) { |
|
| 277 | + function(ElementEvent $event) { |
|
| 278 | 278 | Craft::debug( |
| 279 | 279 | 'Elements::EVENT_AFTER_SAVE_ELEMENT', |
| 280 | 280 | __METHOD__ |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | Event::on( |
| 291 | 291 | Plugins::class, |
| 292 | 292 | Plugins::EVENT_AFTER_LOAD_PLUGINS, |
| 293 | - function () { |
|
| 293 | + function() { |
|
| 294 | 294 | // Install these only after all other plugins have loaded |
| 295 | 295 | $request = Craft::$app->getRequest(); |
| 296 | 296 | // Only respond to non-console site requests |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | Event::on( |
| 315 | 315 | UrlManager::class, |
| 316 | 316 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 317 | - function (RegisterUrlRulesEvent $event) { |
|
| 317 | + function(RegisterUrlRulesEvent $event) { |
|
| 318 | 318 | Craft::debug( |
| 319 | 319 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
| 320 | 320 | __METHOD__ |
@@ -337,15 +337,15 @@ discard block |
||
| 337 | 337 | Event::on( |
| 338 | 338 | Dashboard::class, |
| 339 | 339 | Dashboard::EVENT_REGISTER_WIDGET_TYPES, |
| 340 | - function (RegisterComponentTypesEvent $event) { |
|
| 341 | - $event->types[] = RetourWidget::class; |
|
| 340 | + function(RegisterComponentTypesEvent $event) { |
|
| 341 | + $event->types[ ] = RetourWidget::class; |
|
| 342 | 342 | } |
| 343 | 343 | ); |
| 344 | 344 | // Handler: UrlManager::EVENT_REGISTER_CP_URL_RULES |
| 345 | 345 | Event::on( |
| 346 | 346 | UrlManager::class, |
| 347 | 347 | UrlManager::EVENT_REGISTER_CP_URL_RULES, |
| 348 | - function (RegisterUrlRulesEvent $event) { |
|
| 348 | + function(RegisterUrlRulesEvent $event) { |
|
| 349 | 349 | Craft::debug( |
| 350 | 350 | 'UrlManager::EVENT_REGISTER_CP_URL_RULES', |
| 351 | 351 | __METHOD__ |
@@ -361,20 +361,20 @@ discard block |
||
| 361 | 361 | Event::on( |
| 362 | 362 | UserPermissions::class, |
| 363 | 363 | UserPermissions::EVENT_REGISTER_PERMISSIONS, |
| 364 | - function (RegisterUserPermissionsEvent $event) { |
|
| 364 | + function(RegisterUserPermissionsEvent $event) { |
|
| 365 | 365 | Craft::debug( |
| 366 | 366 | 'UserPermissions::EVENT_REGISTER_PERMISSIONS', |
| 367 | 367 | __METHOD__ |
| 368 | 368 | ); |
| 369 | 369 | // Register our custom permissions |
| 370 | - $event->permissions[Craft::t('retour', 'Retour')] = $this->customAdminCpPermissions(); |
|
| 370 | + $event->permissions[ Craft::t('retour', 'Retour') ] = $this->customAdminCpPermissions(); |
|
| 371 | 371 | } |
| 372 | 372 | ); |
| 373 | 373 | // Handler: ClearCaches::EVENT_REGISTER_CACHE_OPTIONS |
| 374 | 374 | Event::on( |
| 375 | 375 | ClearCaches::class, |
| 376 | 376 | ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, |
| 377 | - function (RegisterCacheOptionsEvent $event) { |
|
| 377 | + function(RegisterCacheOptionsEvent $event) { |
|
| 378 | 378 | Craft::debug( |
| 379 | 379 | 'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS', |
| 380 | 380 | __METHOD__ |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | Event::on( |
| 400 | 400 | ErrorHandler::class, |
| 401 | 401 | ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION, |
| 402 | - function (ExceptionEvent $event) { |
|
| 402 | + function(ExceptionEvent $event) { |
|
| 403 | 403 | Craft::debug( |
| 404 | 404 | 'ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION', |
| 405 | 405 | __METHOD__ |
@@ -441,16 +441,16 @@ discard block |
||
| 441 | 441 | protected function handleElementUriChange(Element $element) |
| 442 | 442 | { |
| 443 | 443 | $uris = $this->getAllElementUris($element); |
| 444 | - if (!empty($this->oldElementUris[$element->id])) { |
|
| 445 | - $oldElementUris = $this->oldElementUris[$element->id]; |
|
| 444 | + if (!empty($this->oldElementUris[ $element->id ])) { |
|
| 445 | + $oldElementUris = $this->oldElementUris[ $element->id ]; |
|
| 446 | 446 | foreach ($uris as $siteId => $newUri) { |
| 447 | - if (!empty($oldElementUris[$siteId])) { |
|
| 448 | - $oldUri = $oldElementUris[$siteId]; |
|
| 447 | + if (!empty($oldElementUris[ $siteId ])) { |
|
| 448 | + $oldUri = $oldElementUris[ $siteId ]; |
|
| 449 | 449 | Craft::debug( |
| 450 | 450 | Craft::t( |
| 451 | 451 | 'retour', |
| 452 | 452 | 'Comparing old: {oldUri} to new: {newUri}', |
| 453 | - ['oldUri' => print_r($oldUri, true), 'newUri' => print_r($newUri, true)] |
|
| 453 | + [ 'oldUri' => print_r($oldUri, true), 'newUri' => print_r($newUri, true) ] |
|
| 454 | 454 | ), |
| 455 | 455 | __METHOD__ |
| 456 | 456 | ); |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | protected function getAllElementUris(Element $element): array |
| 480 | 480 | { |
| 481 | - $uris = []; |
|
| 481 | + $uris = [ ]; |
|
| 482 | 482 | $sites = Craft::$app->getSites()->getAllSites(); |
| 483 | 483 | foreach ($sites as $site) { |
| 484 | 484 | $uri = Craft::$app->getElements()->getElementUriForSite($element->id, $site->id); |
| 485 | 485 | if ($uri !== null) { |
| 486 | - $uris[$site->id] = $uri; |
|
| 486 | + $uris[ $site->id ] = $uri; |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | Craft::t( |
| 492 | 492 | 'retour', |
| 493 | 493 | 'Getting Element URIs: {uris}', |
| 494 | - ['uris' => print_r($uris, true)] |
|
| 494 | + [ 'uris' => print_r($uris, true) ] |
|
| 495 | 495 | ), |
| 496 | 496 | __METHOD__ |
| 497 | 497 | ); |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | [ |
| 559 | 559 | 'key' => 'retour-redirect-caches', |
| 560 | 560 | 'label' => Craft::t('retour', 'Retour redirect caches'), |
| 561 | - 'action' => [self::$plugin->redirects, 'invalidateCaches'], |
|
| 561 | + 'action' => [ self::$plugin->redirects, 'invalidateCaches' ], |
|
| 562 | 562 | ], |
| 563 | 563 | ]; |
| 564 | 564 | } |
@@ -66,13 +66,13 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | public function actionTrim(): int |
| 68 | 68 | { |
| 69 | - echo Craft::t('retour', 'Trimming statistics').PHP_EOL; |
|
| 69 | + echo Craft::t('retour', 'Trimming statistics') . PHP_EOL; |
|
| 70 | 70 | $affectedRows = Retour::$plugin->statistics->trimStatistics($this->limit); |
| 71 | 71 | echo Craft::t( |
| 72 | 72 | 'retour', |
| 73 | 73 | 'Trimmed {rows} from retour_stats table', |
| 74 | - ['rows' => $affectedRows] |
|
| 75 | - ).PHP_EOL; |
|
| 74 | + [ 'rows' => $affectedRows ] |
|
| 75 | + ) . PHP_EOL; |
|
| 76 | 76 | |
| 77 | 77 | return 0; |
| 78 | 78 | } |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | if ($legacyModule === null) { |
| 65 | 65 | return ''; |
| 66 | 66 | } |
| 67 | - $lines = []; |
|
| 67 | + $lines = [ ]; |
|
| 68 | 68 | if ($async) { |
| 69 | - $lines[] = "<link rel=\"preload\" href=\"{$legacyModule}\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\" />"; |
|
| 70 | - $lines[] = "<noscript><link rel=\"stylesheet\" href=\"{$legacyModule}\"></noscript>"; |
|
| 69 | + $lines[ ] = "<link rel=\"preload\" href=\"{$legacyModule}\" as=\"style\" onload=\"this.onload=null;this.rel='stylesheet'\" />"; |
|
| 70 | + $lines[ ] = "<noscript><link rel=\"stylesheet\" href=\"{$legacyModule}\"></noscript>"; |
|
| 71 | 71 | } else { |
| 72 | - $lines[] = "<link rel=\"stylesheet\" href=\"{$legacyModule}\" />"; |
|
| 72 | + $lines[ ] = "<link rel=\"stylesheet\" href=\"{$legacyModule}\" />"; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return implode("\r\n", $lines); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $result = self::getFile($path); |
| 86 | 86 | if ($result) { |
| 87 | - $result = "<style>\r\n".$result."</style>\r\n"; |
|
| 87 | + $result = "<style>\r\n" . $result . "</style>\r\n"; |
|
| 88 | 88 | return $result; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | return ''; |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - $lines = []; |
|
| 130 | + $lines = [ ]; |
|
| 131 | 131 | if ($async) { |
| 132 | - $lines[] = "<script type=\"module\" src=\"{$modernModule}\"></script>"; |
|
| 133 | - $lines[] = "<script nomodule src=\"{$legacyModule}\"></script>"; |
|
| 132 | + $lines[ ] = "<script type=\"module\" src=\"{$modernModule}\"></script>"; |
|
| 133 | + $lines[ ] = "<script nomodule src=\"{$legacyModule}\"></script>"; |
|
| 134 | 134 | } else { |
| 135 | - $lines[] = "<script src=\"{$legacyModule}\"></script>"; |
|
| 135 | + $lines[ ] = "<script src=\"{$legacyModule}\"></script>"; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | return implode("\r\n", $lines); |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | $module = self::getModuleEntry($config, $moduleName, $type, $soft); |
| 184 | 184 | if ($module !== null) { |
| 185 | 185 | $prefix = self::$isHot |
| 186 | - ? $config['devServer']['publicPath'] |
|
| 187 | - : $config['server']['publicPath']; |
|
| 186 | + ? $config[ 'devServer' ][ 'publicPath' ] |
|
| 187 | + : $config[ 'server' ][ 'publicPath' ]; |
|
| 188 | 188 | // If the module isn't a full URL, prefix it |
| 189 | 189 | if (!UrlHelper::isAbsoluteUrl($module)) { |
| 190 | 190 | $module = self::combinePaths($prefix, $module); |
@@ -225,16 +225,16 @@ discard block |
||
| 225 | 225 | $manifest = self::getManifestFile($config, $type); |
| 226 | 226 | if ($manifest !== null) { |
| 227 | 227 | // Make sure it exists in the manifest |
| 228 | - if (empty($manifest[$moduleName])) { |
|
| 228 | + if (empty($manifest[ $moduleName ])) { |
|
| 229 | 229 | self::reportError(Craft::t( |
| 230 | 230 | 'retour', |
| 231 | 231 | 'Module does not exist in the manifest: {moduleName}', |
| 232 | - ['moduleName' => $moduleName] |
|
| 232 | + [ 'moduleName' => $moduleName ] |
|
| 233 | 233 | ), $soft); |
| 234 | 234 | |
| 235 | 235 | return null; |
| 236 | 236 | } |
| 237 | - $module = $manifest[$moduleName]; |
|
| 237 | + $module = $manifest[ $moduleName ]; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $module; |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | $manifest = null; |
| 255 | 255 | // Determine whether we should use the devServer for HMR or not |
| 256 | 256 | $devMode = Craft::$app->getConfig()->getGeneral()->devMode; |
| 257 | - self::$isHot = ($devMode && $config['useDevServer']); |
|
| 257 | + self::$isHot = ($devMode && $config[ 'useDevServer' ]); |
|
| 258 | 258 | // Try to get the manifest |
| 259 | 259 | while ($manifest === null) { |
| 260 | 260 | $manifestPath = self::$isHot |
| 261 | - ? $config['devServer']['manifestPath'] |
|
| 262 | - : $config['server']['manifestPath']; |
|
| 261 | + ? $config[ 'devServer' ][ 'manifestPath' ] |
|
| 262 | + : $config[ 'server' ][ 'manifestPath' ]; |
|
| 263 | 263 | // Normalize the path |
| 264 | - $path = self::combinePaths($manifestPath, $config['manifest'][$type]); |
|
| 264 | + $path = self::combinePaths($manifestPath, $config[ 'manifest' ][ $type ]); |
|
| 265 | 265 | $manifest = self::getJsonFile($path); |
| 266 | 266 | // If the manifest isn't found, and it was hot, fall back on non-hot |
| 267 | 267 | if ($manifest === null) { |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | self::reportError(Craft::t( |
| 270 | 270 | 'retour', |
| 271 | 271 | 'Manifest file not found at: {manifestPath}', |
| 272 | - ['manifestPath' => $manifestPath] |
|
| 272 | + [ 'manifestPath' => $manifestPath ] |
|
| 273 | 273 | ), true); |
| 274 | 274 | if (self::$isHot) { |
| 275 | 275 | // Try again, but not with home module replacement |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | if ($path !== null) { |
| 314 | 314 | $path = self::combinePaths( |
| 315 | - $config['localFiles']['basePath'], |
|
| 315 | + $config[ 'localFiles' ][ 'basePath' ], |
|
| 316 | 316 | $path |
| 317 | 317 | ); |
| 318 | 318 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | protected static function getJsonFile(string $path) |
| 333 | 333 | { |
| 334 | - return self::getFileFromUri($path, [self::class, 'jsonFileDecode']); |
|
| 334 | + return self::getFileFromUri($path, [ self::class, 'jsonFileDecode' ]); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | protected static function getFileContents(string $path, callable $callback = null) |
| 386 | 386 | { |
| 387 | 387 | // Return the memoized manifest if it exists |
| 388 | - if (!empty(self::$files[$path])) { |
|
| 389 | - return self::$files[$path]; |
|
| 388 | + if (!empty(self::$files[ $path ])) { |
|
| 389 | + return self::$files[ $path ]; |
|
| 390 | 390 | } |
| 391 | 391 | // Create the dependency tags |
| 392 | 392 | $dependency = new TagDependency([ |
| 393 | 393 | 'tags' => [ |
| 394 | 394 | self::CACHE_TAG, |
| 395 | - self::CACHE_TAG.$path, |
|
| 395 | + self::CACHE_TAG . $path, |
|
| 396 | 396 | ], |
| 397 | 397 | ]); |
| 398 | 398 | // Set the cache duration based on devMode |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | // Get the result from the cache, or parse the file |
| 403 | 403 | $cache = Craft::$app->getCache(); |
| 404 | 404 | $file = $cache->getOrSet( |
| 405 | - self::CACHE_KEY.$path, |
|
| 406 | - function () use ($path, $callback) { |
|
| 405 | + self::CACHE_KEY . $path, |
|
| 406 | + function() use ($path, $callback) { |
|
| 407 | 407 | $result = null; |
| 408 | 408 | $contents = @file_get_contents($path); |
| 409 | 409 | if ($contents) { |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $cacheDuration, |
| 419 | 419 | $dependency |
| 420 | 420 | ); |
| 421 | - self::$files[$path] = $file; |
|
| 421 | + self::$files[ $path ] = $file; |
|
| 422 | 422 | |
| 423 | 423 | return $file; |
| 424 | 424 | } |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | protected static function combinePaths(string ...$paths): string |
| 434 | 434 | { |
| 435 | 435 | $last_key = \count($paths) - 1; |
| 436 | - array_walk($paths, function (&$val, $key) use ($last_key) { |
|
| 436 | + array_walk($paths, function(&$val, $key) use ($last_key) { |
|
| 437 | 437 | switch ($key) { |
| 438 | 438 | case 0: |
| 439 | 439 | $val = rtrim($val, '/ '); |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | $last = array_pop($paths); |
| 452 | 452 | $paths = array_filter($paths); |
| 453 | 453 | array_unshift($paths, $first); |
| 454 | - $paths[] = $last; |
|
| 454 | + $paths[ ] = $last; |
|
| 455 | 455 | |
| 456 | 456 | return implode('/', $paths); |
| 457 | 457 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | public function rules() |
| 90 | 90 | { |
| 91 | 91 | return [ |
| 92 | - ['pluginName', 'string'], |
|
| 93 | - ['pluginName', 'default', 'value' => 'Retour'], |
|
| 92 | + [ 'pluginName', 'string' ], |
|
| 93 | + [ 'pluginName', 'default', 'value' => 'Retour' ], |
|
| 94 | 94 | [ |
| 95 | 95 | [ |
| 96 | 96 | 'createUriChangeRedirects', |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | ], |
| 102 | 102 | 'boolean' |
| 103 | 103 | ], |
| 104 | - ['staticRedirectDisplayLimit', 'integer', 'min' => 1], |
|
| 105 | - ['staticRedirectDisplayLimit', 'default', 'value' => 100], |
|
| 106 | - ['dynamicRedirectDisplayLimit', 'integer', 'min' => 1], |
|
| 107 | - ['dynamicRedirectDisplayLimit', 'default', 'value' => 100], |
|
| 108 | - ['statsStoredLimit', 'integer', 'min' => 1], |
|
| 109 | - ['statsStoredLimit', 'default', 'value' => 1000], |
|
| 110 | - ['statsDisplayLimit', 'integer', 'min' => 1], |
|
| 111 | - ['statsDisplayLimit', 'default', 'value' => 1000], |
|
| 104 | + [ 'staticRedirectDisplayLimit', 'integer', 'min' => 1 ], |
|
| 105 | + [ 'staticRedirectDisplayLimit', 'default', 'value' => 100 ], |
|
| 106 | + [ 'dynamicRedirectDisplayLimit', 'integer', 'min' => 1 ], |
|
| 107 | + [ 'dynamicRedirectDisplayLimit', 'default', 'value' => 100 ], |
|
| 108 | + [ 'statsStoredLimit', 'integer', 'min' => 1 ], |
|
| 109 | + [ 'statsStoredLimit', 'default', 'value' => 1000 ], |
|
| 110 | + [ 'statsDisplayLimit', 'integer', 'min' => 1 ], |
|
| 111 | + [ 'statsDisplayLimit', 'default', 'value' => 1000 ], |
|
| 112 | 112 | ]; |
| 113 | 113 | } |
| 114 | 114 | |