public function check(JWT $jwt, int $index, array $mandatoryHeaderParameters = [])
    {
        foreach ($this->tokenTypes as $tokenType) {
            if ($tokenType->supports($jwt)) {
                $protected = [];
                $unprotected = [];
                $tokenType->retrieveTokenHeaders($jwt, $index, $protected, $unprotected);
                $this->checkDuplicatedHeaderParameters($protected, $unprotected);
                $this->checkMandatoryHeaderParameters($mandatoryHeaderParameters, $protected, $unprotected);
                $this->checkHeaders($protected, $unprotected);

                return;
            }
        }

        throw new \InvalidArgumentException('Unsupported token type.');
    }
public function check(JWT $jwt, int $index, array $mandatoryHeaderParameters = [])
    {
        foreach ($this->tokenTypes as $tokenType) {
            if ($tokenType->supports($jwt)) {
                $protected = [];
                $unprotected = [];
                $tokenType->retrieveTokenHeaders($jwt, $index, $protected, $unprotected);
                $this->checkDuplicatedHeaderParameters($protected, $unprotected);
                $this->checkMandatoryHeaderParameters($mandatoryHeaderParameters, $protected, $unprotected);
                $this->checkHeaders($protected, $unprotected);

                return;
            }
        }

        throw new \InvalidArgumentException('Unsupported token type.');
    }
public function check ( JWT $ jwt , int $ index , array $ mandatoryHeaderParameters = [ ] ) { foreach ( $ this -> tokenTypes as $ tokenType ) { if ( $ tokenType -> supports ( $ jwt ) ) { $ protected = [ ] ; $ unprotected = [ ] ; $ tokenType -> retrieveTokenHeaders ( $ jwt , $ index , $ protected , $ unprotected ) ; $ this -> checkDuplicatedHeaderParameters ( $ protected , $ unprotected ) ; $ this -> checkMandatoryHeaderParameters ( $ mandatoryHeaderParameters , $ protected , $ unprotected ) ; $ this -> checkHeaders ( $ protected , $ unprotected ) ; return ; } } throw new \ InvalidArgumentException ( 'Unsupported token type.' ) ; }
This method checks all the header parameters passed as argument.
All header parameters are checked against the header parameter checkers.
If one fails, the InvalidHeaderException is thrown.

@param string[] $mandatoryHeaderParameters

@throws InvalidHeaderException
@throws MissingMandatoryHeaderParameterException
This method checks all the header parameters passed as argument . All header parameters are checked against the header parameter checkers . If one fails the InvalidHeaderException is thrown .