From d3cef1479103158152cdf5a2a72af645a690cff2 Mon Sep 17 00:00:00 2001 From: millken Date: Sun, 16 Sep 2018 11:50:05 +0800 Subject: [PATCH] save work --- .../Factory/SwooleApplicationFactory.php | 1 - src/Application/SwooleApplication.php | 14 +------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/Application/Factory/SwooleApplicationFactory.php b/src/Application/Factory/SwooleApplicationFactory.php index d988cfc..8e8f049 100644 --- a/src/Application/Factory/SwooleApplicationFactory.php +++ b/src/Application/Factory/SwooleApplicationFactory.php @@ -94,7 +94,6 @@ public function build(ContainerInterface $container) $routes = new CallbackCollection($container->get('routes'), $routeCallback); $app = new SwooleApplication( - $container->has('static-files') ? $container->get('static-files') : [], $routes, $container->has(RequestHandlerInterface::class) ? $container->get(RequestHandlerInterface::class) : null, diff --git a/src/Application/SwooleApplication.php b/src/Application/SwooleApplication.php index 1b626fe..e0ef06d 100644 --- a/src/Application/SwooleApplication.php +++ b/src/Application/SwooleApplication.php @@ -16,7 +16,6 @@ use Ypf\Router\Exceptions\MethodNotAllowedException; use GuzzleHttp\Psr7\Response; use Swoole\Http\Server; -use Ypf\Swoole\StaticResourceHandler; class SwooleApplication implements ApplicationInterface, LoggerAwareInterface { @@ -27,17 +26,12 @@ class SwooleApplication implements ApplicationInterface, LoggerAwareInterface */ protected $routes = []; - private $staticResourceHandler; private $requestHandler; use LoggerAwareTrait; - public function __construct(array $staticFiles, iterable $routes, RequestHandlerInterface $rootHandler = null, Server $server) + public function __construct(iterable $routes, RequestHandlerInterface $rootHandler = null, Server $server) { - //check static files - if ($staticFiles) { - $this->staticResourceHandler = new StaticResourceHandler($staticFiles); - } $this->routes = $routes; $this->requestHandler = $rootHandler; $this->server = $server; @@ -51,12 +45,6 @@ public function run(): void public function onRequest(\Swoole\Http\Request $request, \Swoole\Http\Response $response): void { - if ($this->staticResourceHandler) { - $result = $this->staticResourceHandler->handle($request, $response); - if ($result) { - return; - } - } $_SERVER = []; foreach ($request->server as $name => $value) { $_SERVER[strtoupper($name)] = $value;