private function processBeginRequestRecord(int $requestId, ?string $contentData): void
    {
        if (isset($this->requests[$requestId])) {
            throw new ProtocolException('Unexpected FCGI_BEGIN_REQUEST record');
        }

        $contentFormat = 'nrole/Cflags/x5';

        $content = unpack($contentFormat, $contentData);

        $keepAlive = DaemonInterface::FCGI_KEEP_CONNECTION & $content['flags'];

        $this->requests[$requestId] = [
            'keepAlive' => $keepAlive,
            'stdin'     => fopen('php://temp', 'r+'),
            'params'    => [],
        ];

        if ($this->shutdown) {
            $this->endRequest($requestId, 0, DaemonInterface::FCGI_OVERLOADED);

            return;
        }

        if (DaemonInterface::FCGI_RESPONDER !== $content['role']) {
            $this->endRequest($requestId, 0, DaemonInterface::FCGI_UNKNOWN_ROLE);

            return;
        }
    }