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;
        }
    }
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;
        }
    }
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 ; } }
Process a FCGI_BEGIN_REQUEST record.

@param int    $requestId   The request id sending the record
@param null|string $contentData The content of the record

@throws ProtocolException If the FCGI_BEGIN_REQUEST record is unexpected
Process a FCGI_BEGIN_REQUEST record .