Skip to content

Commit 78657cd

Browse files
authored
Merge pull request #1486 from antonL95/feat_add_nette_framework_driver
Adding support for Nette Framework.
2 parents 0844c56 + 4a43ab0 commit 78657cd

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace Valet\Drivers\Specific;
4+
5+
use Valet\Drivers\ValetDriver;
6+
7+
class NetteValetDriver extends ValetDriver
8+
{
9+
/**
10+
* Determine if the driver serves the request.
11+
*/
12+
public function serves(string $sitePath, string $siteName, string $uri): bool
13+
{
14+
return file_exists($sitePath.'/www/index.php')
15+
&& file_exists($sitePath.'/www/.htaccess')
16+
&& file_exists($sitePath.'/config/common.neon')
17+
&& file_exists($sitePath.'/config/services.neon');
18+
}
19+
20+
/**
21+
* Determine if the incoming request is for a static file.
22+
*/
23+
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */
24+
{
25+
if ($this->isActualFile($staticFilePath = $sitePath.'/www/'.$uri)) {
26+
return $staticFilePath;
27+
}
28+
29+
return false;
30+
}
31+
32+
/**
33+
* Get the fully resolved path to the application's front controller.
34+
*/
35+
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
36+
{
37+
$_SERVER['DOCUMENT_ROOT'] = $sitePath.'/www';
38+
$_SERVER['SCRIPT_FILENAME'] = $sitePath.'/www/index.php';
39+
$_SERVER['SCRIPT_NAME'] = '/index.php';
40+
$_SERVER['PHP_SELF'] = '/index.php';
41+
42+
return $sitePath.'/www/index.php';
43+
}
44+
}

0 commit comments

Comments
 (0)