Conditions | 2 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public static function httpd( |
||
46 | Address $listen, |
||
47 | Closure $processor, |
||
48 | string $serviced = 'server' |
||
49 | ) : HTTP { |
||
50 | return new NVServer( |
||
51 | $serviced, |
||
52 | $listen, |
||
53 | (new Events)->attach(Events\HTTP::REQUESTING, function (Connection $conn) use ($processor) { |
||
54 | try { |
||
55 | $processor($conn); |
||
56 | } catch (Throwable $e) { |
||
57 | $conn->reply(new Response(500, [], $e->getTraceAsString())); |
||
58 | } |
||
63 |