mirror of
https://github.com/notrab/dumbo.git
synced 2025-01-16 21:58:25 +01:00
feat: fallback to dev server if none provided
This commit is contained in:
parent
b44f3ebc90
commit
219ae52bf3
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Dumbo;
|
||||
|
||||
use Dumbo\Adapters\PhpDevelopmentServer;
|
||||
|
||||
class Dumbo
|
||||
{
|
||||
private $routes = [];
|
||||
@ -9,9 +11,9 @@ class Dumbo
|
||||
private $prefix = "";
|
||||
private $server;
|
||||
|
||||
public function __construct(ServerInterface $server)
|
||||
public function __construct(ServerInterface $server = null)
|
||||
{
|
||||
$this->server = $server;
|
||||
$this->server = $server ?? $this->createDefaultServer();
|
||||
}
|
||||
|
||||
public function __call($method, $arguments)
|
||||
@ -181,4 +183,9 @@ class Dumbo
|
||||
|
||||
return $next($context);
|
||||
}
|
||||
|
||||
private function createDefaultServer(): ServerInterface
|
||||
{
|
||||
return new PhpDevelopmentServer();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user