Skip to content

Commit

Permalink
Move Swoole-nyholm to a new package
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Jul 17, 2021
1 parent c3b4c34 commit 4d8f354
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 179 deletions.
24 changes: 0 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,6 @@ return function () {
};
```

### PSR

```php
// public/index.php

use Nyholm\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

class App implements RequestHandlerInterface {
public function handle(ServerRequestInterface $request): ResponseInterface {
$name = $request->getQueryParams()['name'] ?? 'World';
return new Response(200, ['Server' => 'swoole-runtime'], "Hello, $name!");
}
}

return function(): RequestHandlerInterface {
return new App();
};
```

### Symfony

```php
Expand Down
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
}
],
"require": {
"nyholm/psr7": "^1.4",
"psr/http-server-handler": "^1.0",
"symfony/runtime": "^5.3 || ^6.0"
},
"require-dev": {
Expand Down
81 changes: 0 additions & 81 deletions src/RequestHandlerRunner.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Runtime\Swoole;

use Illuminate\Contracts\Http\Kernel;
use Psr\Http\Server\RequestHandlerInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Runtime\RunnerInterface;
use Symfony\Component\Runtime\SymfonyRuntime;
Expand Down Expand Up @@ -38,10 +37,6 @@ public function getRunner(?object $application): RunnerInterface
return new LaravelRunner($this->serverFactory, $application);
}

if ($application instanceof RequestHandlerInterface) {
return new RequestHandlerRunner($this->serverFactory, $application);
}

return parent::getRunner($application);
}
}
54 changes: 0 additions & 54 deletions tests/Unit/RequestHandlerRunnerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Unit/RuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

use Illuminate\Contracts\Http\Kernel;
use PHPUnit\Framework\TestCase;
use Psr\Http\Server\RequestHandlerInterface;
use Runtime\Swoole\CallableRunner;
use Runtime\Swoole\LaravelRunner;
use Runtime\Swoole\RequestHandlerRunner;
use Runtime\Swoole\Runtime;
use Runtime\Swoole\SymfonyRunner;
use Symfony\Component\HttpKernel\HttpKernelInterface;
Expand Down Expand Up @@ -49,17 +47,6 @@ public function testGetRunnerCreatesARunnerForLaravel(): void
self::assertInstanceOf(LaravelRunner::class, $runner);
}

public function testGetRunnerCreatesARunnerForRequestHandlers(): void
{
$options = [];
$runtime = new Runtime($options);

$application = $this->createMock(RequestHandlerInterface::class);
$runner = $runtime->getRunner($application);

self::assertInstanceOf(RequestHandlerRunner::class, $runner);
}

public function testGetRunnerFallbacksToClosureRunner(): void
{
$options = [];
Expand Down

0 comments on commit 4d8f354

Please sign in to comment.