From a73be25a76fd0ecdc1aeec64c0d7d482b965b9e6 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 18 Dec 2022 21:08:41 +0000 Subject: [PATCH] Apply fixes from StyleCI --- cli/Valet/Drivers/BasicValetDriver.php | 6 ++-- cli/Valet/Drivers/LaravelValetDriver.php | 6 ++-- .../Drivers/Specific/BedrockValetDriver.php | 6 ++-- .../Drivers/Specific/JigsawValetDriver.php | 2 +- .../Drivers/Specific/JoomlaValetDriver.php | 6 ++-- .../Drivers/Specific/KatanaValetDriver.php | 2 +- .../Drivers/Specific/NeosValetDriver.php | 8 ++--- .../Drivers/Specific/Typo3ValetDriver.php | 8 ++--- .../Drivers/Specific/WordPressValetDriver.php | 6 ++-- cli/Valet/Drivers/ValetDriver.php | 8 ++--- cli/Valet/Server.php | 32 +++++++++---------- cli/includes/require-drivers.php | 4 +-- server.php | 3 +- 13 files changed, 48 insertions(+), 49 deletions(-) diff --git a/cli/Valet/Drivers/BasicValetDriver.php b/cli/Valet/Drivers/BasicValetDriver.php index acebdb7..f9c32a1 100644 --- a/cli/Valet/Drivers/BasicValetDriver.php +++ b/cli/Valet/Drivers/BasicValetDriver.php @@ -20,9 +20,9 @@ public function serves(string $sitePath, string $siteName, string $uri): bool /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void diff --git a/cli/Valet/Drivers/LaravelValetDriver.php b/cli/Valet/Drivers/LaravelValetDriver.php index a1f4fc5..d977a5d 100644 --- a/cli/Valet/Drivers/LaravelValetDriver.php +++ b/cli/Valet/Drivers/LaravelValetDriver.php @@ -21,9 +21,9 @@ public function serves(string $sitePath, string $siteName, string $uri): bool /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void diff --git a/cli/Valet/Drivers/Specific/BedrockValetDriver.php b/cli/Valet/Drivers/Specific/BedrockValetDriver.php index a765231..89cf343 100644 --- a/cli/Valet/Drivers/Specific/BedrockValetDriver.php +++ b/cli/Valet/Drivers/Specific/BedrockValetDriver.php @@ -25,9 +25,9 @@ public function serves(string $sitePath, string $siteName, string $uri): bool /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void diff --git a/cli/Valet/Drivers/Specific/JigsawValetDriver.php b/cli/Valet/Drivers/Specific/JigsawValetDriver.php index c74c6f8..fb14d14 100644 --- a/cli/Valet/Drivers/Specific/JigsawValetDriver.php +++ b/cli/Valet/Drivers/Specific/JigsawValetDriver.php @@ -16,7 +16,7 @@ class JigsawValetDriver extends BasicValetDriver */ public function serves(string $sitePath, string $siteName, string $uri): bool { - return is_dir($sitePath . '/build_local'); + return is_dir($sitePath.'/build_local'); } /** diff --git a/cli/Valet/Drivers/Specific/JoomlaValetDriver.php b/cli/Valet/Drivers/Specific/JoomlaValetDriver.php index eebb033..7f33753 100644 --- a/cli/Valet/Drivers/Specific/JoomlaValetDriver.php +++ b/cli/Valet/Drivers/Specific/JoomlaValetDriver.php @@ -22,9 +22,9 @@ public function serves(string $sitePath, string $siteName, string $uri): bool /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void diff --git a/cli/Valet/Drivers/Specific/KatanaValetDriver.php b/cli/Valet/Drivers/Specific/KatanaValetDriver.php index e205ef3..bc20071 100644 --- a/cli/Valet/Drivers/Specific/KatanaValetDriver.php +++ b/cli/Valet/Drivers/Specific/KatanaValetDriver.php @@ -16,7 +16,7 @@ class KatanaValetDriver extends BasicValetDriver */ public function serves(string $sitePath, string $siteName, string $uri): bool { - return file_exists($sitePath . '/katana'); + return file_exists($sitePath.'/katana'); } /** diff --git a/cli/Valet/Drivers/Specific/NeosValetDriver.php b/cli/Valet/Drivers/Specific/NeosValetDriver.php index bd1e536..04f89d9 100644 --- a/cli/Valet/Drivers/Specific/NeosValetDriver.php +++ b/cli/Valet/Drivers/Specific/NeosValetDriver.php @@ -22,16 +22,16 @@ public function serves(string $sitePath, string $siteName, string $uri): bool /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void { putenv('FLOW_CONTEXT=Development'); putenv('FLOW_REWRITEURLS=1'); - $_SERVER['SCRIPT_FILENAME'] = $sitePath . '/Web/index.php'; + $_SERVER['SCRIPT_FILENAME'] = $sitePath.'/Web/index.php'; $_SERVER['SCRIPT_NAME'] = '/index.php'; } diff --git a/cli/Valet/Drivers/Specific/Typo3ValetDriver.php b/cli/Valet/Drivers/Specific/Typo3ValetDriver.php index cca6a7f..24d4f13 100644 --- a/cli/Valet/Drivers/Specific/Typo3ValetDriver.php +++ b/cli/Valet/Drivers/Specific/Typo3ValetDriver.php @@ -44,9 +44,9 @@ class Typo3ValetDriver extends ValetDriver /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void @@ -54,7 +54,7 @@ public function beforeLoading(string $sitePath, string $siteName, string $uri): // without modifying the URI, redirect if necessary $this->handleRedirectBackendShorthandUris($uri); - $_SERVER['SERVER_NAME'] = $siteName . '.dev'; + $_SERVER['SERVER_NAME'] = $siteName.'.dev'; $_SERVER['DOCUMENT_URI'] = $uri; $_SERVER['SCRIPT_NAME'] = $uri; $_SERVER['PHP_SELF'] = $uri; diff --git a/cli/Valet/Drivers/Specific/WordPressValetDriver.php b/cli/Valet/Drivers/Specific/WordPressValetDriver.php index fa2b295..2c26239 100644 --- a/cli/Valet/Drivers/Specific/WordPressValetDriver.php +++ b/cli/Valet/Drivers/Specific/WordPressValetDriver.php @@ -22,9 +22,9 @@ public function serves(string $sitePath, string $siteName, string $uri): bool /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void diff --git a/cli/Valet/Drivers/ValetDriver.php b/cli/Valet/Drivers/ValetDriver.php index 5ee7095..f525813 100644 --- a/cli/Valet/Drivers/ValetDriver.php +++ b/cli/Valet/Drivers/ValetDriver.php @@ -122,15 +122,15 @@ public static function specificDrivers(): array { return array_map(function ($item) { return 'Specific\\'.$item; - }, static::driversIn(__DIR__ . '/Specific')); + }, static::driversIn(__DIR__.'/Specific')); } /** * Take any steps necessary before loading the front controller for this driver. * - * @param string $sitePath - * @param string $siteName - * @param string $uri + * @param string $sitePath + * @param string $siteName + * @param string $uri * @return void */ public function beforeLoading(string $sitePath, string $siteName, string $uri): void diff --git a/cli/Valet/Server.php b/cli/Valet/Server.php index 3660ef4..0e62810 100644 --- a/cli/Valet/Server.php +++ b/cli/Valet/Server.php @@ -12,10 +12,10 @@ public function __construct(array $config) } /** - * Extract $uri from $SERVER['REQUEST_URI'] variable + * Extract $uri from $SERVER['REQUEST_URI'] variable. * - * @param string $requestUri $_SERVER['REQUEST_URI'] - * @return string + * @param string $requestUri $_SERVER['REQUEST_URI'] + * @return string */ public function uriFromRequestUri(string $requestUri): string { @@ -25,10 +25,10 @@ public function uriFromRequestUri(string $requestUri): string } /** - * Extract site name from HTTP host, stripping www. and supporting wildcard DNS + * Extract site name from HTTP host, stripping www. and supporting wildcard DNS. * - * @param string $httpHost - * @return string + * @param string $httpHost + * @return string */ public function siteNameFromHttpHost(string $httpHost): string { @@ -50,8 +50,8 @@ public function siteNameFromHttpHost(string $httpHost): string * First, determine the IP address of your local computer (like 192.168.0.10). * Then, visit http://project.your-ip.nip.io - e.g.: http://laravel.192.168.0.10.nip.io. * - * @param string $domain - * @return string + * @param string $domain + * @return string */ public function allowWildcardDnsDomains(string $domain): string { @@ -68,12 +68,12 @@ public function allowWildcardDnsDomains(string $domain): string foreach ($services as $service) { $pattern = preg_quote($service, '#'); $pattern = str_replace('\*', '.*', $pattern); - $patterns[] = '(.*)' . $pattern; + $patterns[] = '(.*)'.$pattern; } $pattern = implode('|', $patterns); - if (preg_match('#(?:' . $pattern . ')\z#u', $domain, $matches)) { + if (preg_match('#(?:'.$pattern.')\z#u', $domain, $matches)) { $domain = array_pop($matches); } @@ -117,7 +117,7 @@ public function sitePath(string $siteName): string $dirs = []; while (false !== ($file = readdir($handle))) { - if (is_dir($path . '/' . $file) && !in_array($file, ['.', '..'])) { + if (is_dir($path.'/'.$file) && ! in_array($file, ['.', '..'])) { $dirs[] = $file; } } @@ -128,12 +128,12 @@ public function sitePath(string $siteName): string foreach ($dirs as $dir) { if (strtolower($dir) === $siteName) { // early return when exact match for linked subdomain - return $path . '/' . $dir; + return $path.'/'.$dir; } if (strtolower($dir) === $domain) { // no early return here because the foreach may still have some subdomains to process with higher priority - $valetSitePath = $path . '/' . $dir; + $valetSitePath = $path.'/'.$dir; } } @@ -149,7 +149,7 @@ public function sitePath(string $siteName): string public function show404() { http_response_code(404); - require __DIR__ . '/cli/templates/404.html'; + require __DIR__.'/cli/templates/404.html'; exit; } @@ -172,9 +172,9 @@ public function defaultSitePath(): ?string public function showDirectoryListing(string $valetSitePath, string $uri) { $is_root = ($uri == '/'); - $directory = ($is_root) ? $valetSitePath : $valetSitePath . $uri; + $directory = ($is_root) ? $valetSitePath : $valetSitePath.$uri; - if (!file_exists($directory)) { + if (! file_exists($directory)) { show_valet_404(); } diff --git a/cli/includes/require-drivers.php b/cli/includes/require-drivers.php index 7845d5e..3e5ab92 100644 --- a/cli/includes/require-drivers.php +++ b/cli/includes/require-drivers.php @@ -3,8 +3,8 @@ require_once './cli/Valet/Drivers/ValetDriver.php'; foreach (scandir('./cli/Valet/Drivers') as $file) { - $path = './cli/Valet/Drivers/' . $file; - if (substr($file, 0, 1) !== '.' && !is_dir($path)) { + $path = './cli/Valet/Drivers/'.$file; + if (substr($file, 0, 1) !== '.' && ! is_dir($path)) { require_once $path; } } diff --git a/server.php b/server.php index 9b444bc..4e9b323 100644 --- a/server.php +++ b/server.php @@ -72,9 +72,8 @@ } /** - * Allow for drivers to take pre-loading actions (e.g. setting server variables) + * Allow for drivers to take pre-loading actions (e.g. setting server variables). */ - $valetDriver->beforeLoading($valetSitePath, $siteName, $uri); /**