Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compatible with Valet version 4 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions WordPressProxyValetDriver.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace Valet\Drivers\Custom;

use Valet\Drivers\Specific\WordPressValetDriver;

/**
* Class WordPressProxyValetDriver
* @author Jeff Sagal
Expand Down Expand Up @@ -57,7 +61,7 @@ class WordPressProxyValetDriver extends WordPressValetDriver
* @param string $uri
* @return bool
*/
public function serves($sitePath, $siteName, $uri)
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return file_exists("$sitePath/$this->configFile");
}
Expand Down Expand Up @@ -88,7 +92,7 @@ public function isStaticFile($sitePath, $siteName, $uri)
* @param string $siteName
* @param string $uri
*/
public function serveStaticFile($staticFilePath, $sitePath, $siteName, $uri)
public function serveStaticFile(string $staticFilePath, string $sitePath, string $siteName, string $uri): void
{
if ($this->shouldProxy($uri) && !file_exists($staticFilePath)) {
$proxy = $this->getProxyUrl($sitePath);
Expand All @@ -113,7 +117,7 @@ public function shouldProxy($uri)
$dirName = pathinfo($uri, PATHINFO_DIRNAME);

return in_array($extension, $this->proxyable) &&
strpos($dirName, 'wp-content/uploads') !== false;
strpos($dirName, 'content/uploads') !== false;
}

/**
Expand All @@ -128,4 +132,5 @@ protected function getProxyUrl($sitePath)

return rtrim($proxy);
}

}