28 lines
802 B
PHP
28 lines
802 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Valet\Drivers\Specific\Magento2ValetDriver;
|
|
|
|
final class LocalValetDriver extends Magento2ValetDriver
|
|
{
|
|
private const WEBSITE_BY_HOST = [
|
|
'esun3d.test' => 'us_site',
|
|
'au.esun3d.test' => 'au',
|
|
'en.esun3d.test' => 'uk',
|
|
'eu.esun3d.test' => 'eu',
|
|
];
|
|
|
|
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
|
|
{
|
|
$host = strtolower((string)($_SERVER['HTTP_HOST'] ?? ''));
|
|
$host = explode(':', $host, 2)[0];
|
|
|
|
if (isset(self::WEBSITE_BY_HOST[$host])) {
|
|
$_SERVER['MAGE_RUN_CODE'] = self::WEBSITE_BY_HOST[$host];
|
|
$_SERVER['MAGE_RUN_TYPE'] = 'website';
|
|
}
|
|
|
|
return parent::frontControllerPath($sitePath, $siteName, $uri);
|
|
}
|
|
}
|