TraceMiddleware
Captures names of executed middleware for debugging.
Synopsis
Section titled “Synopsis”class TraceMiddleware implements MiddlewareInterface
| Implements | MiddlewareInterface |
| Source | Middleware/TraceMiddleware.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(bool $emitHeader = false, string $headerName = 'X-Quiote-Trace'): mixed
| Parameter | Type | Description |
|---|---|---|
$emitHeader | bool | |
$headerName | string |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface | Appends this middleware’s class name to the ExecutionState trace. |
process()
Section titled “process()”public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
Appends this middleware’s class name to the ExecutionState trace.
Reuses the ExecutionState already on the request, or creates one and attaches it, and records static::class so a subclass traces under its own name. When the constructor enabled the header, the trace is re-read from the shared ExecutionState after the downstream handler returns, so entries appended by middleware further down the stack are included; non-scalar entries are rendered as their debug type.
| Parameter | Type | Description |
|---|---|---|
$request | ServerRequestInterface | |
$handler | RequestHandlerInterface |
Returns ResponseInterface