Files
ladill-servers/app/Services/Hosting/PanelRuntimeResolver.php
T
isaaccladandCursor b6c8ac343f Extract Ladill Servers as standalone app at servers.ladill.com.
VPS and dedicated server ordering, managed panels, SSO, billing, and launcher integration — forked from hosting infrastructure with server-focused routes and dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 19:18:30 +00:00

31 lines
878 B
PHP

<?php
namespace App\Services\Hosting;
use App\Models\CustomerHostingOrder;
use App\Models\HostingAccount;
use App\Services\Hosting\Contracts\PanelRuntimeInterface;
use App\Services\Hosting\PanelRuntimes\SharedHostingPanelRuntime;
use InvalidArgumentException;
use RuntimeException;
class PanelRuntimeResolver
{
public function __construct(
private SharedHostingPanelRuntime $sharedHostingRuntime,
) {}
public function forSubject(mixed $subject): PanelRuntimeInterface
{
if ($subject instanceof HostingAccount) {
return $this->sharedHostingRuntime;
}
if ($subject instanceof CustomerHostingOrder) {
throw new RuntimeException('Server-backed hosting panel runtime is not enabled yet for this order.');
}
throw new InvalidArgumentException('Unsupported panel runtime subject.');
}
}