-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
LocalValetDriver.php
43 lines (36 loc) · 1.01 KB
/
LocalValetDriver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
declare(strict_types=1);
use Valet\Drivers\ValetDriver;
class LocalValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return true;
}
/**
* Determine if the incoming request is for a static file.
*/
public function isStaticFile(string $sitePath, string $siteName, string $uri)/* : string|false */
{
if (file_exists($staticFilePath = $sitePath . '/public/' . $uri)) {
return $staticFilePath;
}
if (
str_ends_with($uri, '.png')
|| str_ends_with($uri, '.jpg')
) {
return $staticFilePath;
}
return false;
}
/**
* Get the fully resolved path to the application's front controller.
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): string
{
return $sitePath . '/public/index.php';
}
}