mirror of
https://github.com/notrab/dumbo.git
synced 2025-01-17 06:08:31 +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;
|
namespace Dumbo;
|
||||||
|
|
||||||
|
use Dumbo\Adapters\PhpDevelopmentServer;
|
||||||
|
|
||||||
class Dumbo
|
class Dumbo
|
||||||
{
|
{
|
||||||
private $routes = [];
|
private $routes = [];
|
||||||
@ -9,9 +11,9 @@ class Dumbo
|
|||||||
private $prefix = "";
|
private $prefix = "";
|
||||||
private $server;
|
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)
|
public function __call($method, $arguments)
|
||||||
@ -181,4 +183,9 @@ class Dumbo
|
|||||||
|
|
||||||
return $next($context);
|
return $next($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createDefaultServer(): ServerInterface
|
||||||
|
{
|
||||||
|
return new PhpDevelopmentServer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user