-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1486 from antonL95/feat_add_nette_framework_driver
Adding support for Nette Framework.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Valet\Drivers\Specific; | ||
|
||
use Valet\Drivers\ValetDriver; | ||
|
||
class NetteValetDriver extends ValetDriver | ||
{ | ||
/** | ||
* Determine if the driver serves the request. | ||
*/ | ||
public function serves(string $sitePath, string $siteName, string $uri): bool | ||
{ | ||
return file_exists($sitePath.'/www/index.php') | ||
&& file_exists($sitePath.'/www/.htaccess') | ||
&& file_exists($sitePath.'/config/common.neon') | ||
&& file_exists($sitePath.'/config/services.neon'); | ||
} | ||
|
||
/** | ||
* Determine if the incoming request is for a static file. | ||
*/ | ||
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */ | ||
{ | ||
if ($this->isActualFile($staticFilePath = $sitePath.'/www/'.$uri)) { | ||
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 | ||
{ | ||
$_SERVER['DOCUMENT_ROOT'] = $sitePath.'/www'; | ||
$_SERVER['SCRIPT_FILENAME'] = $sitePath.'/www/index.php'; | ||
$_SERVER['SCRIPT_NAME'] = '/index.php'; | ||
$_SERVER['PHP_SELF'] = '/index.php'; | ||
|
||
return $sitePath.'/www/index.php'; | ||
} | ||
} |