mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 16:50:09 +01:00
Apply fixes from StyleCI
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ public function beforeLoading(string $sitePath, string $siteName, string $uri):
|
||||
{
|
||||
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';
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -122,7 +122,7 @@ public static function specificDrivers(): array
|
||||
{
|
||||
return array_map(function ($item) {
|
||||
return 'Specific\\'.$item;
|
||||
}, static::driversIn(__DIR__ . '/Specific'));
|
||||
}, static::driversIn(__DIR__.'/Specific'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,7 @@ 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
|
||||
@@ -25,7 +25,7 @@ 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
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user