<commit_before><?php

namespace Zenstruck\JWT\Validator;

use Zenstruck\JWT\Exception\Validation\MissingClaim;
use Zenstruck\JWT\Exception\Validation\UnacceptableToken;
use Zenstruck\JWT\Token;
use Zenstruck\JWT\Validator;

/**
 * @author <NAME> <<EMAIL>>
 */
final class NotBeforeValidator implements Validator
{
    private $currentTime;

    /**
     * @param \DateTime|null $currentTime
     */
    public function __construct(\DateTime $currentTime = null)
    {
        $this->currentTime = $currentTime ?: new \DateTime('now');
    }

    /**
     * {@inheritdoc}
     */
    public function validate(Token $token)
    {
        if (null === $notBefore = $token->notBefore()) {
            throw new MissingClaim(Token::CLAIM_NBF, $token);
        }

        if (false === $token->isAcceptable($this->currentTime)) {
            throw new UnacceptableToken($token);
        }
    }
}<commit_msg>removed unused variable per sensiolabs insight<commit_after><?php

namespace Zenstruck\JWT\Validator;

use Zenstruck\JWT\Exception\Validation\MissingClaim;
use Zenstruck\JWT\Exception\Validation\UnacceptableToken;
use Zenstruck\JWT\Token;
use Zenstruck\JWT\Validator;

/**
 * @author <NAME> <<EMAIL>>
 */
final class NotBeforeValidator implements Validator
{
    private $currentTime;

    /**
     * @param \DateTime|null $currentTime
     */
    public function __construct(\DateTime $currentTime = null)
    {
        $this->currentTime = $currentTime ?: new \DateTime('now');
    }

    /**
     * {@inheritdoc}
     */
    public function validate(Token $token)
    {
        if (null === $token->notBefore()) {
            throw new MissingClaim(Token::CLAIM_NBF, $token);
        }

        if (false === $token->isAcceptable($this->currentTime)) {
            throw new UnacceptableToken($token);
        }
    }
}
{'fraction_non_alphanumeric': 0.13596491228070176, 'fraction_numerical': 0.0, 'mean_word_length': 2.9163090128755367, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '349672', 'n_tokens_mistral': 557, 'n_tokens_neox': 541, 'n_words': 108}