| @@ -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 | } | 
| @@ -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 | } | 
| @@ -47,11 +47,11 @@ | ||
| 47 | 47 | $bundle->sourcePath, | 
| 48 | 48 | true | 
| 49 | 49 | ); | 
| 50 | - self::$config['server']['manifestPath'] = Craft::getAlias($bundle->sourcePath); | |
| 51 | - self::$config['server']['publicPath'] = $baseAssetsUrl; | |
| 50 | + self::$config[ 'server' ][ 'manifestPath' ] = Craft::getAlias($bundle->sourcePath); | |
| 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 | |
| @@ -96,18 +96,18 @@ discard block | ||
| 96 | 96 | public function rules() | 
| 97 | 97 |      { | 
| 98 | 98 | return [ | 
| 99 | - ['id', 'integer'], | |
| 100 | - ['siteId', 'integer'], | |
| 101 | - ['siteId', 'default', 'value' => null], | |
| 102 | - ['associatedElementId', 'default', 'value' => 0], | |
| 103 | - ['associatedElementId', 'integer'], | |
| 104 | - ['enabled', 'boolean'], | |
| 105 | - ['redirectSrcMatch', 'default', 'value' => 'pathonly'], | |
| 106 | - ['redirectSrcMatch', DbStringValidator::class, 'max' => 32], | |
| 107 | - ['redirectSrcMatch', 'string'], | |
| 108 | - ['redirectMatchType', 'default', 'value' => 'exactmatch'], | |
| 109 | - ['redirectMatchType', DbStringValidator::class, 'max' => 32], | |
| 110 | - ['redirectMatchType', 'string'], | |
| 99 | + [ 'id', 'integer' ], | |
| 100 | + [ 'siteId', 'integer' ], | |
| 101 | + [ 'siteId', 'default', 'value' => null ], | |
| 102 | + [ 'associatedElementId', 'default', 'value' => 0 ], | |
| 103 | + [ 'associatedElementId', 'integer' ], | |
| 104 | + [ 'enabled', 'boolean' ], | |
| 105 | + [ 'redirectSrcMatch', 'default', 'value' => 'pathonly' ], | |
| 106 | + [ 'redirectSrcMatch', DbStringValidator::class, 'max' => 32 ], | |
| 107 | + [ 'redirectSrcMatch', 'string' ], | |
| 108 | + [ 'redirectMatchType', 'default', 'value' => 'exactmatch' ], | |
| 109 | + [ 'redirectMatchType', DbStringValidator::class, 'max' => 32 ], | |
| 110 | + [ 'redirectMatchType', 'string' ], | |
| 111 | 111 | [ | 
| 112 | 112 | [ | 
| 113 | 113 | 'redirectSrcUrl', | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | 'default', | 
| 118 | 118 | 'value' => '' | 
| 119 | 119 | ], | 
| 120 | - ['redirectSrcUrlParsed', ParsedUriValidator::class, 'source' => 'redirectSrcUrl'], | |
| 120 | + [ 'redirectSrcUrlParsed', ParsedUriValidator::class, 'source' => 'redirectSrcUrl' ], | |
| 121 | 121 | [ | 
| 122 | 122 | [ | 
| 123 | 123 | 'redirectSrcUrl', | 
| @@ -144,11 +144,11 @@ discard block | ||
| 144 | 144 | ], | 
| 145 | 145 | 'string' | 
| 146 | 146 | ], | 
| 147 | - ['redirectHttpCode', 'integer'], | |
| 148 | - ['redirectHttpCode', 'default', 'value' => 301], | |
| 149 | - ['hitCount', 'default', 'value' => 0], | |
| 150 | - ['hitCount', 'integer'], | |
| 151 | - ['hitLastTime', 'safe'], | |
| 147 | + [ 'redirectHttpCode', 'integer' ], | |
| 148 | + [ 'redirectHttpCode', 'default', 'value' => 301 ], | |
| 149 | + [ 'hitCount', 'default', 'value' => 0 ], | |
| 150 | + [ 'hitCount', 'integer' ], | |
| 151 | + [ 'hitLastTime', 'safe' ], | |
| 152 | 152 | ]; | 
| 153 | 153 | } | 
| 154 | 154 | |
| @@ -94,9 +94,9 @@ discard block | ||
| 94 | 94 | public function rules() | 
| 95 | 95 |      { | 
| 96 | 96 | return [ | 
| 97 | - ['id', 'integer'], | |
| 98 | - ['siteId', 'integer'], | |
| 99 | - ['siteId', 'default', 'value' => null], | |
| 97 | + [ 'id', 'integer' ], | |
| 98 | + [ 'siteId', 'integer' ], | |
| 99 | + [ 'siteId', 'default', 'value' => null ], | |
| 100 | 100 | [ | 
| 101 | 101 | [ | 
| 102 | 102 | 'redirectSrcUrl', | 
| @@ -126,19 +126,19 @@ discard block | ||
| 126 | 126 | 'default', | 
| 127 | 127 | 'value' => '' | 
| 128 | 128 | ], | 
| 129 | - ['exceptionFileLine', 'integer'], | |
| 130 | - ['exceptionFileLine', 'default', 'value' => 0], | |
| 131 | - ['referrerUrl', DbStringValidator::class, 'max' => 2000], | |
| 132 | - ['referrerUrl', 'string'], | |
| 133 | - ['referrerUrl', 'default', 'value' => ''], | |
| 134 | - ['remoteIp', DbStringValidator::class, 'max' => 45], | |
| 135 | - ['remoteIp', 'string'], | |
| 136 | - ['remoteIp', 'default', 'value' => ''], | |
| 137 | - ['hitCount', 'integer'], | |
| 138 | - ['hitCount', 'default', 'value' => 0], | |
| 139 | - ['hitLastTime', 'safe'], | |
| 140 | - ['handledByRetour', 'integer', 'min' => 0, 'max' => 1], | |
| 141 | - ['handledByRetour', 'default', 'value' => 0], | |
| 129 | + [ 'exceptionFileLine', 'integer' ], | |
| 130 | + [ 'exceptionFileLine', 'default', 'value' => 0 ], | |
| 131 | + [ 'referrerUrl', DbStringValidator::class, 'max' => 2000 ], | |
| 132 | + [ 'referrerUrl', 'string' ], | |
| 133 | + [ 'referrerUrl', 'default', 'value' => '' ], | |
| 134 | + [ 'remoteIp', DbStringValidator::class, 'max' => 45 ], | |
| 135 | + [ 'remoteIp', 'string' ], | |
| 136 | + [ 'remoteIp', 'default', 'value' => '' ], | |
| 137 | + [ 'hitCount', 'integer' ], | |
| 138 | + [ 'hitCount', 'default', 'value' => 0 ], | |
| 139 | + [ 'hitLastTime', 'safe' ], | |
| 140 | + [ 'handledByRetour', 'integer', 'min' => 0, 'max' => 1 ], | |
| 141 | + [ 'handledByRetour', 'default', 'value' => 0 ], | |
| 142 | 142 | ]; | 
| 143 | 143 | } | 
| 144 | 144 | |