Skip to content

Commit 489eb96

Browse files
committed
add NeosValetDriver
1 parent dc29141 commit 489eb96

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

cli/drivers/NeosValetDriver.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
class NeosValetDriver extends ValetDriver
4+
{
5+
/**
6+
* Determine if the driver serves the request.
7+
*
8+
* @param string $sitePath
9+
* @param string $siteName
10+
* @param string $uri
11+
* @return bool
12+
*/
13+
public function serves($sitePath, $siteName, $uri)
14+
{
15+
return file_exists($sitePath.'/flow') && is_dir($sitePath.'/Web');
16+
}
17+
18+
/**
19+
* Determine if the incoming request is for a static file.
20+
*
21+
* @param string $sitePath
22+
* @param string $siteName
23+
* @param string $uri
24+
* @return string|false
25+
*/
26+
public function isStaticFile($sitePath, $siteName, $uri)
27+
{
28+
if ($this->isActualFile($staticFilePath = $sitePath.'/Web'.$uri)) {
29+
return $staticFilePath;
30+
}
31+
return false;
32+
}
33+
34+
/**
35+
* Get the fully resolved path to the application's front controller.
36+
*
37+
* @param string $sitePath
38+
* @param string $siteName
39+
* @param string $uri
40+
* @return string
41+
*/
42+
public function frontControllerPath($sitePath, $siteName, $uri)
43+
{
44+
putenv('FLOW_CONTEXT=Development');
45+
putenv('FLOW_REWRITEURLS=1');
46+
$_SERVER['SCRIPT_FILENAME'] = $sitePath.'/Web/index.php';
47+
$_SERVER['SCRIPT_NAME'] = '/index.php';
48+
return $sitePath.'/Web/index.php';
49+
}
50+
}

cli/drivers/ValetDriver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public static function assign($sitePath, $siteName, $uri)
6868
$drivers[] = 'DrupalValetDriver';
6969
$drivers[] = 'Concrete5ValetDriver';
7070
$drivers[] = 'Typo3ValetDriver';
71+
$drivers[] = 'NeosValetDriver';
7172

7273
$drivers[] = 'BasicValetDriver';
7374

cli/drivers/require.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@
2626
require_once __DIR__.'/DrupalValetDriver.php';
2727
require_once __DIR__.'/Concrete5ValetDriver.php';
2828
require_once __DIR__.'/Typo3ValetDriver.php';
29+
require_once __DIR__.'/NeosValetDriver.php';

0 commit comments

Comments
 (0)