mirror of
https://github.com/laravel/valet.git
synced 2026-02-07 17:10:05 +01:00
Fix Radicle code style with Pint
This commit is contained in:
@@ -8,67 +8,56 @@ class RadicleValetDriver extends BasicValetDriver
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine if the driver serves the request.
|
* Determine if the driver serves the request.
|
||||||
*
|
|
||||||
* @param string $sitePath
|
|
||||||
* @param string $siteName
|
|
||||||
* @param string $uri
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function serves(string $sitePath, string $siteName, string $uri): bool
|
public function serves(string $sitePath, string $siteName, string $uri): bool
|
||||||
{
|
{
|
||||||
return file_exists($sitePath . '/public/content/mu-plugins/bedrock-autoloader.php') &&
|
return file_exists($sitePath.'/public/content/mu-plugins/bedrock-autoloader.php') &&
|
||||||
file_exists($sitePath . '/public/wp-config.php') &&
|
file_exists($sitePath.'/public/wp-config.php') &&
|
||||||
file_exists($sitePath . '/bedrock/application.php');
|
file_exists($sitePath.'/bedrock/application.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the incoming request is for a static file.
|
* Determine if the incoming request is for a static file.
|
||||||
*
|
*
|
||||||
* @param string $sitePath
|
|
||||||
* @param string $siteName
|
|
||||||
* @param string $uri
|
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */
|
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */
|
||||||
{
|
{
|
||||||
$staticFilePath = $sitePath . '/public' . $uri;
|
$staticFilePath = $sitePath.'/public'.$uri;
|
||||||
if ($this->isActualFile($staticFilePath)) {
|
if ($this->isActualFile($staticFilePath)) {
|
||||||
return $staticFilePath;
|
return $staticFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the fully resolved path to the application's front controller.
|
* Get the fully resolved path to the application's front controller.
|
||||||
*
|
|
||||||
* @param string $sitePath
|
|
||||||
* @param string $siteName
|
|
||||||
* @param string $uri
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function frontControllerPath(string $sitePath, string $siteName, string $uri): string
|
public function frontControllerPath(string $sitePath, string $siteName, string $uri): string
|
||||||
{
|
{
|
||||||
$_SERVER['PHP_SELF'] = $uri;
|
$_SERVER['PHP_SELF'] = $uri;
|
||||||
if (strpos($uri, '/wp/') === 0) {
|
if (strpos($uri, '/wp/') === 0) {
|
||||||
return is_dir($sitePath . '/public' . $uri)
|
return is_dir($sitePath.'/public'.$uri)
|
||||||
? $sitePath . '/public' . $this->forceTrailingSlash($uri) . '/index.php'
|
? $sitePath.'/public'.$this->forceTrailingSlash($uri).'/index.php'
|
||||||
: $sitePath . '/public' . $uri;
|
: $sitePath.'/public'.$uri;
|
||||||
}
|
}
|
||||||
return $sitePath . '/public/index.php';
|
|
||||||
|
return $sitePath.'/public/index.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect to uri with trailing slash.
|
* Redirect to uri with trailing slash.
|
||||||
*
|
*
|
||||||
* @param string $uri
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function forceTrailingSlash(string $uri)
|
private function forceTrailingSlash(string $uri)
|
||||||
{
|
{
|
||||||
if (substr($uri, -1 * strlen('/wp/wp-admin')) == '/wp/wp-admin') {
|
if (substr($uri, -1 * strlen('/wp/wp-admin')) == '/wp/wp-admin') {
|
||||||
header('Location: ' . $uri . '/');
|
header('Location: '.$uri.'/');
|
||||||
die;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user