private function _wrapUp(ValidatorState $state, Certificate $cert): ValidatorState
    {
        $tbs_cert = $cert->tbsCertificate();
        $extensions = $tbs_cert->extensions();
        // (a)
        if ($state->explicitPolicy() > 0) {
            $state = $state->withExplicitPolicy($state->explicitPolicy() - 1);
        }
        // (b)
        if ($extensions->hasPolicyConstraints()) {
            $ext = $extensions->policyConstraints();
            if ($ext->hasRequireExplicitPolicy() &&
                 $ext->requireExplicitPolicy() == 0) {
                $state = $state->withExplicitPolicy(0);
            }
        }
        // (c)(d)(e)
        $state = $this->_setPublicKeyState($state, $cert);
        // (f) process relevant extensions
        $state = $this->_processExtensions($state, $cert);
        // (g) intersection of valid_policy_tree and the initial-policy-set
        $state = $this->_calculatePolicyIntersection($state);
        // check that explicit_policy > 0 or valid_policy_tree is set
        if (!($state->explicitPolicy() > 0 || $state->hasValidPolicyTree())) {
            throw new PathValidationException("No valid policies.");
        }
        // path validation succeeded
        return $state;
    }
private function _wrapUp(ValidatorState $state, Certificate $cert): ValidatorState
    {
        $tbs_cert = $cert->tbsCertificate();
        $extensions = $tbs_cert->extensions();
        // (a)
        if ($state->explicitPolicy() > 0) {
            $state = $state->withExplicitPolicy($state->explicitPolicy() - 1);
        }
        // (b)
        if ($extensions->hasPolicyConstraints()) {
            $ext = $extensions->policyConstraints();
            if ($ext->hasRequireExplicitPolicy() &&
                 $ext->requireExplicitPolicy() == 0) {
                $state = $state->withExplicitPolicy(0);
            }
        }
        // (c)(d)(e)
        $state = $this->_setPublicKeyState($state, $cert);
        // (f) process relevant extensions
        $state = $this->_processExtensions($state, $cert);
        // (g) intersection of valid_policy_tree and the initial-policy-set
        $state = $this->_calculatePolicyIntersection($state);
        // check that explicit_policy > 0 or valid_policy_tree is set
        if (!($state->explicitPolicy() > 0 || $state->hasValidPolicyTree())) {
            throw new PathValidationException("No valid policies.");
        }
        // path validation succeeded
        return $state;
    }
private function _wrapUp ( ValidatorState $ state , Certificate $ cert ) : ValidatorState { $ tbs_cert = $ cert -> tbsCertificate ( ) ; $ extensions = $ tbs_cert -> extensions ( ) ; // (a) if ( $ state -> explicitPolicy ( ) > 0 ) { $ state = $ state -> withExplicitPolicy ( $ state -> explicitPolicy ( ) - 1 ) ; } // (b) if ( $ extensions -> hasPolicyConstraints ( ) ) { $ ext = $ extensions -> policyConstraints ( ) ; if ( $ ext -> hasRequireExplicitPolicy ( ) && $ ext -> requireExplicitPolicy ( ) == 0 ) { $ state = $ state -> withExplicitPolicy ( 0 ) ; } } // (c)(d)(e) $ state = $ this -> _setPublicKeyState ( $ state , $ cert ) ; // (f) process relevant extensions $ state = $ this -> _processExtensions ( $ state , $ cert ) ; // (g) intersection of valid_policy_tree and the initial-policy-set $ state = $ this -> _calculatePolicyIntersection ( $ state ) ; // check that explicit_policy > 0 or valid_policy_tree is set if ( ! ( $ state -> explicitPolicy ( ) > 0 || $ state -> hasValidPolicyTree ( ) ) ) { throw new PathValidationException ( "No valid policies." ) ; } // path validation succeeded return $ state ; }
Apply wrap-up procedure according to RFC 5280 section 6.1.5.

@link https://tools.ietf.org/html/rfc5280#section-6.1.5
@param ValidatorState $state
@param Certificate $cert
@throws PathValidationException
@return ValidatorState
Apply wrap - up procedure according to RFC 5280 section 6 . 1 . 5 .