Skip to content

Commit

Permalink
Merge pull request #57 from allan-simon/patch-1
Browse files Browse the repository at this point in the history
allow to use custom runtime
  • Loading branch information
mnapoli authored Aug 27, 2024
2 parents ffea2e1 + 65ee2c6 commit cce0757
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/HandlerResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Psr\Container\ContainerInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Runtime\SymfonyRuntime;

/**
* This class resolves handlers.
Expand Down Expand Up @@ -114,7 +115,12 @@ private function symfonyContainer(?string $bootstrapFile = null): ContainerInter
if ($projectDir) {
$options['project_dir'] = $projectDir;
}
$runtime = new BrefRuntime($options);

$runtimeClass = $_SERVER['APP_RUNTIME'] ?? $_ENV['APP_RUNTIME'] ?? BrefRuntime::class;
$runtime = new $runtimeClass($options);
if (! $runtime instanceof SymfonyRuntime) {
throw new \RuntimeException(sprintf('The runtime class "%s" must extend Symfony\Component\Runtime\SymfonyRuntime.', $runtimeClass));
}

[$app, $args] = $runtime
->getResolver($app)
Expand Down

0 comments on commit cce0757

Please sign in to comment.