Skip to content

Commit

Permalink
save work
Browse files Browse the repository at this point in the history
  • Loading branch information
millken committed Sep 16, 2018
1 parent 3f8b4eb commit d3cef14
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion src/Application/Factory/SwooleApplicationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 1 addition & 13 deletions src/Application/SwooleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit d3cef14

Please sign in to comment.