private function parseWwwAuthenticateHeader(string $wwwAuthenticate): void
    {
        if ('Digest ' == substr($wwwAuthenticate, 0, 7)) {
            $this->setAuthenticationMethod('Digest');
            // Remove "Digest " from start of header
            $wwwAuthenticate = substr($wwwAuthenticate, 7, \strlen($wwwAuthenticate) - 7);

            $nameValuePairs = $this->parseNameValuePairs($wwwAuthenticate);

            foreach ($nameValuePairs as $name => $value) {
                switch ($name) {
                    case 'algorithm':
                        $this->setAlgorithm($value);

                        break;
                    case 'domain':
                        $this->setDomain($value);

                        break;
                    case 'nonce':
                        $this->setNonce($value);

                        break;
                    case 'realm':
                        $this->setRealm($value);

                        break;
                    case 'opaque':
                        $this->setOpaque($value);

                        break;
                    case 'qop':
                        $this->setQOP(explode(',', $value));

                        break;
                }
            }
        }
        if ('Basic ' == substr($wwwAuthenticate, 0, 6)) {
            $this->setAuthenticationMethod('Basic');
            // Remove "Basic " from start of header
            $wwwAuthenticate = substr($wwwAuthenticate, 6, \strlen($wwwAuthenticate) - 6);

            $nameValuePairs = $this->parseNameValuePairs($wwwAuthenticate);

            foreach ($nameValuePairs as $name => $value) {
                switch ($name) {
                    case 'realm':
                        $this->setRealm($value);

                        break;
                }
            }
        }
    }
private function parseWwwAuthenticateHeader(string $wwwAuthenticate): void
    {
        if ('Digest ' == substr($wwwAuthenticate, 0, 7)) {
            $this->setAuthenticationMethod('Digest');
            // Remove "Digest " from start of header
            $wwwAuthenticate = substr($wwwAuthenticate, 7, \strlen($wwwAuthenticate) - 7);

            $nameValuePairs = $this->parseNameValuePairs($wwwAuthenticate);

            foreach ($nameValuePairs as $name => $value) {
                switch ($name) {
                    case 'algorithm':
                        $this->setAlgorithm($value);

                        break;
                    case 'domain':
                        $this->setDomain($value);

                        break;
                    case 'nonce':
                        $this->setNonce($value);

                        break;
                    case 'realm':
                        $this->setRealm($value);

                        break;
                    case 'opaque':
                        $this->setOpaque($value);

                        break;
                    case 'qop':
                        $this->setQOP(explode(',', $value));

                        break;
                }
            }
        }
        if ('Basic ' == substr($wwwAuthenticate, 0, 6)) {
            $this->setAuthenticationMethod('Basic');
            // Remove "Basic " from start of header
            $wwwAuthenticate = substr($wwwAuthenticate, 6, \strlen($wwwAuthenticate) - 6);

            $nameValuePairs = $this->parseNameValuePairs($wwwAuthenticate);

            foreach ($nameValuePairs as $name => $value) {
                switch ($name) {
                    case 'realm':
                        $this->setRealm($value);

                        break;
                }
            }
        }
    }
private function parseWwwAuthenticateHeader ( string $ wwwAuthenticate ) : void { if ( 'Digest ' == substr ( $ wwwAuthenticate , 0 , 7 ) ) { $ this -> setAuthenticationMethod ( 'Digest' ) ; // Remove "Digest " from start of header $ wwwAuthenticate = substr ( $ wwwAuthenticate , 7 , \ strlen ( $ wwwAuthenticate ) - 7 ) ; $ nameValuePairs = $ this -> parseNameValuePairs ( $ wwwAuthenticate ) ; foreach ( $ nameValuePairs as $ name => $ value ) { switch ( $ name ) { case 'algorithm' : $ this -> setAlgorithm ( $ value ) ; break ; case 'domain' : $ this -> setDomain ( $ value ) ; break ; case 'nonce' : $ this -> setNonce ( $ value ) ; break ; case 'realm' : $ this -> setRealm ( $ value ) ; break ; case 'opaque' : $ this -> setOpaque ( $ value ) ; break ; case 'qop' : $ this -> setQOP ( explode ( ',' , $ value ) ) ; break ; } } } if ( 'Basic ' == substr ( $ wwwAuthenticate , 0 , 6 ) ) { $ this -> setAuthenticationMethod ( 'Basic' ) ; // Remove "Basic " from start of header $ wwwAuthenticate = substr ( $ wwwAuthenticate , 6 , \ strlen ( $ wwwAuthenticate ) - 6 ) ; $ nameValuePairs = $ this -> parseNameValuePairs ( $ wwwAuthenticate ) ; foreach ( $ nameValuePairs as $ name => $ value ) { switch ( $ name ) { case 'realm' : $ this -> setRealm ( $ value ) ; break ; } } } }
Parses the WWW-Authenticate header received from the server and calls the relevant setter method on each variable received.

@param string $wwwAuthenticate the full WWW-Authenticate header
Parses the WWW - Authenticate header received from the server and calls the relevant setter method on each variable received .