Skip to content

SwooleRequestSnapshotFactory

The only place in this package that touches \Swoole\Http\Request.

Kept to a single method so everything else stays testable without ext-swoole.

final class SwooleRequestSnapshotFactory

SourceSwooleRequestSnapshotFactory.php
MethodDescription
fromSwoole(Request $request): SwooleRequestSnapshotCopies a Swoole request into a plain SwooleRequestSnapshot that the rest of the package can work with without ext-swoole.

public static function fromSwoole(Request $request): SwooleRequestSnapshot

Copies a Swoole request into a plain SwooleRequestSnapshot that the rest of the package can work with without ext-swoole.

Each of the server/header/get/post/cookie/files bags is null on a Swoole request that carries none of that kind, and becomes an empty array here; a request with no body at all (rawContent() returning false) becomes an empty body string.

ParameterTypeDescription
$requestRequest

Returns SwooleRequestSnapshot