@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | // so we can't extract it from the passed in $config |
| 40 | 40 | $majorVersion = '4'; |
| 41 | 41 | // Dev server container name & port are based on the major version of this plugin |
| 42 | - $devPort = 3000 + (int)$majorVersion; |
|
| 43 | - $versionName = 'v' . $majorVersion; |
|
| 42 | + $devPort = 3000 + (int) $majorVersion; |
|
| 43 | + $versionName = 'v'.$majorVersion; |
|
| 44 | 44 | return [ |
| 45 | 45 | 'components' => [ |
| 46 | 46 | 'events' => Events::class, |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | 'assetClass' => RetourAsset::class, |
| 52 | 52 | 'checkDevServer' => true, |
| 53 | 53 | 'class' => VitePluginService::class, |
| 54 | - 'devServerInternal' => 'http://craft-retour-' . $versionName . '-buildchain-dev:' . $devPort, |
|
| 55 | - 'devServerPublic' => 'http://localhost:' . $devPort, |
|
| 54 | + 'devServerInternal' => 'http://craft-retour-'.$versionName.'-buildchain-dev:'.$devPort, |
|
| 55 | + 'devServerPublic' => 'http://localhost:'.$devPort, |
|
| 56 | 56 | 'errorEntry' => 'src/js/Retour.js', |
| 57 | 57 | 'useDevServer' => true, |
| 58 | 58 | ], |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function getRecentStatistics(int $days = 1, bool $handled = false): array |
| 77 | 77 | { |
| 78 | 78 | // Ensure is an int |
| 79 | - $handledInt = (int)$handled; |
|
| 79 | + $handledInt = (int) $handled; |
|
| 80 | 80 | $stats = []; |
| 81 | 81 | $db = Craft::$app->getDb(); |
| 82 | 82 | if ($db->getIsMysql()) { |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | $stats->userAgent = $userAgent; |
| 212 | 212 | $stats->exceptionMessage = $exceptionMessage; |
| 213 | 213 | $stats->exceptionFilePath = $exceptionFilePath; |
| 214 | - $stats->exceptionFileLine = (int)$exceptionFileLine; |
|
| 214 | + $stats->exceptionFileLine = (int) $exceptionFileLine; |
|
| 215 | 215 | $stats->hitLastTime = Db::prepareDateForDb(new DateTime()); |
| 216 | - $stats->handledByRetour = (int)$handled; |
|
| 216 | + $stats->handledByRetour = (int) $handled; |
|
| 217 | 217 | $stats->hitCount++; |
| 218 | 218 | $statsConfig = $stats->getAttributes(); |
| 219 | 219 | // Record the updated statistics |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $now = round(microtime(true) * 1000); |
| 287 | 287 | $cache = Craft::$app->getCache(); |
| 288 | 288 | $then = $cache->get(self::LAST_STATISTICS_TRIM_CACHE_KEY); |
| 289 | - if (($then !== false) && ($now - (int)$then < Retour::$settings->statisticsRateLimitMs)) { |
|
| 289 | + if (($then !== false) && ($now - (int) $then < Retour::$settings->statisticsRateLimitMs)) { |
|
| 290 | 290 | $limited = true; |
| 291 | 291 | } |
| 292 | 292 | $cache->set(self::LAST_STATISTICS_TRIM_CACHE_KEY, $now, 0); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * @var array|bool |
| 40 | 40 | */ |
| 41 | - protected array|bool $allowAnonymous = [ |
|
| 41 | + protected array | bool $allowAnonymous = [ |
|
| 42 | 42 | ]; |
| 43 | 43 | |
| 44 | 44 | // Public Methods |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function actionTrim(): int |
| 65 | 65 | { |
| 66 | - echo Craft::t('retour', 'Trimming statistics') . PHP_EOL; |
|
| 66 | + echo Craft::t('retour', 'Trimming statistics').PHP_EOL; |
|
| 67 | 67 | $affectedRows = Retour::$plugin->statistics->trimStatistics($this->limit); |
| 68 | 68 | echo Craft::t( |
| 69 | 69 | 'retour', |
| 70 | 70 | 'Trimmed {rows} from retour_stats table', |
| 71 | 71 | ['rows' => $affectedRows] |
| 72 | - ) . PHP_EOL; |
|
| 72 | + ).PHP_EOL; |
|
| 73 | 73 | |
| 74 | 74 | return 0; |
| 75 | 75 | } |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | */ |
| 93 | 93 | public static function getLogFilePath(string $fileName): string |
| 94 | 94 | { |
| 95 | - $logfile = $fileName . "-" . date(self::FILE_PER_DAY); |
|
| 95 | + $logfile = $fileName."-".date(self::FILE_PER_DAY); |
|
| 96 | 96 | |
| 97 | 97 | return Craft::getAlias("@storage/logs/$logfile.log"); |
| 98 | 98 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | $type = GqlEntityRegistry::createEntity(self::class, new InterfaceType([ |
| 49 | 49 | 'name' => static::getName(), |
| 50 | - 'fields' => self::class . '::getFieldDefinitions', |
|
| 50 | + 'fields' => self::class.'::getFieldDefinitions', |
|
| 51 | 51 | 'description' => 'This is the interface implemented by Retour.', |
| 52 | 52 | 'resolveType' => function(array $value) { |
| 53 | 53 | return GqlEntityRegistry::getEntity(RetourGenerator::getName()); |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | 'retour' => [ |
| 42 | 42 | 'type' => RetourInterface::getType(), |
| 43 | 43 | 'args' => RetourArguments::getArguments(), |
| 44 | - 'resolve' => RetourResolver::class . '::resolve', |
|
| 44 | + 'resolve' => RetourResolver::class.'::resolve', |
|
| 45 | 45 | 'description' => 'This query is used to query for Retour redirects.', |
| 46 | 46 | 'deprecationReason' => 'This query is deprecated and will be removed in the future. You should use `retourResolveRedirect` instead.', |
| 47 | 47 | ], |
| 48 | 48 | 'retourResolveRedirect' => [ |
| 49 | 49 | 'type' => RetourInterface::getType(), |
| 50 | 50 | 'args' => RetourArguments::getArguments(), |
| 51 | - 'resolve' => RetourResolver::class . '::resolve', |
|
| 51 | + 'resolve' => RetourResolver::class.'::resolve', |
|
| 52 | 52 | 'description' => 'This query is used to query for Retour redirects.', |
| 53 | 53 | ], |
| 54 | 54 | 'retourRedirects' => [ |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | 'description' => 'The siteId to list all redirects for.', |
| 66 | 66 | ], |
| 67 | 67 | ], |
| 68 | - 'resolve' => RetourResolver::class . '::resolveAll', |
|
| 68 | + 'resolve' => RetourResolver::class.'::resolveAll', |
|
| 69 | 69 | 'description' => 'This query is used to query for all Retour redirects for a site.', |
| 70 | 70 | ], |
| 71 | 71 | ]; |
@@ -65,8 +65,8 @@ |
||
| 65 | 65 | // Set the `site` virtual field |
| 66 | 66 | $redirect['site'] = null; |
| 67 | 67 | $redirect['siteId'] = $siteId; |
| 68 | - if (isset($redirect['siteId']) && (int)$redirect['siteId'] !== 0) { |
|
| 69 | - $site = Craft::$app->getSites()->getSiteById((int)$redirect['siteId']); |
|
| 68 | + if (isset($redirect['siteId']) && (int) $redirect['siteId'] !== 0) { |
|
| 69 | + $site = Craft::$app->getSites()->getSiteById((int) $redirect['siteId']); |
|
| 70 | 70 | if ($site !== null) { |
| 71 | 71 | $redirect['site'] = $site->handle; |
| 72 | 72 | } |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | return static function(ECSConfig $ecsConfig): void { |
| 7 | 7 | $ecsConfig->paths([ |
| 8 | - __DIR__ . '/src', |
|
| 8 | + __DIR__.'/src', |
|
| 9 | 9 | __FILE__, |
| 10 | 10 | ]); |
| 11 | 11 | $ecsConfig->parallel(); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | // Protected Properties |
| 89 | 89 | // ========================================================================= |
| 90 | 90 | |
| 91 | - protected array|bool|int $allowAnonymous = []; |
|
| 91 | + protected array | bool | int $allowAnonymous = []; |
|
| 92 | 92 | |
| 93 | 93 | // Public Methods |
| 94 | 94 | // ========================================================================= |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | $index++; |
| 192 | 192 | } |
| 193 | 193 | $redirectDump = print_r($redirectConfig, true); |
| 194 | - Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
| 194 | + Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
| 195 | 195 | if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) { |
| 196 | - Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
| 196 | + Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
| 197 | 197 | $hasErrors = true; |
| 198 | 198 | } |
| 199 | 199 | $rowIndex++; |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | $index++; |
| 234 | 234 | } |
| 235 | 235 | $redirectDump = print_r($redirectConfig, true); |
| 236 | - Craft::debug("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
| 236 | + Craft::debug("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
| 237 | 237 | if (!Retour::$plugin->redirects->saveRedirect($redirectConfig)) { |
| 238 | - Craft::info("-> ROW #$rowIndex contents: " . $redirectDump, __METHOD__); |
|
| 238 | + Craft::info("-> ROW #$rowIndex contents: ".$redirectDump, __METHOD__); |
|
| 239 | 239 | $hasErrors = true; |
| 240 | 240 | } |
| 241 | 241 | $rowIndex++; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $variables['docsUrl'] = self::DOCUMENTATION_URL; |
| 285 | 285 | $variables['pluginName'] = $pluginName; |
| 286 | 286 | $variables['title'] = $templateTitle; |
| 287 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 287 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 288 | 288 | $variables['crumbs'] = [ |
| 289 | 289 | [ |
| 290 | 290 | 'label' => $pluginName, |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | ], |
| 293 | 293 | [ |
| 294 | 294 | 'label' => 'Redirects', |
| 295 | - 'url' => UrlHelper::cpUrl('retour/redirects' . $siteHandleUri), |
|
| 295 | + 'url' => UrlHelper::cpUrl('retour/redirects'.$siteHandleUri), |
|
| 296 | 296 | ], |
| 297 | 297 | ]; |
| 298 | 298 | $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}"; |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $file = UploadedFile::getInstanceByName('file'); |
| 303 | 303 | if ($file !== null) { |
| 304 | 304 | $filename = uniqid($file->name, true); |
| 305 | - $filePath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $filename; |
|
| 305 | + $filePath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$filename; |
|
| 306 | 306 | $file->saveAs($filePath, false); |
| 307 | 307 | // Also save the file to the cache as a backup way to access it |
| 308 | 308 | $fileContents = @file_get_contents($filePath); |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | $csv->insertOne(array_values($columns)); |
| 422 | 422 | $csv->insertAll($data); |
| 423 | - $csv->output($filename . '.csv'); |
|
| 423 | + $csv->output($filename.'.csv'); |
|
| 424 | 424 | exit(0); |
| 425 | 425 | } |
| 426 | 426 | |