public function isValid($token)
    {
        try {
            $publicKey = openssl_pkey_get_public(file_get_contents($this->projectDir . '/var/jwt/public.pem'));

            $jws = SimpleJWS::load($token);

            return $jws->verify($publicKey, self::ALG) && $this->isTokenNotExpired($token);
        } catch (\InvalidArgumentException $ex) {
            return false;
        }
    }
public function isValid($token)
    {
        try {
            $publicKey = openssl_pkey_get_public(file_get_contents($this->projectDir . '/var/jwt/public.pem'));

            $jws = SimpleJWS::load($token);

            return $jws->verify($publicKey, self::ALG) && $this->isTokenNotExpired($token);
        } catch (\InvalidArgumentException $ex) {
            return false;
        }
    }
public function isValid ( $ token ) { try { $ publicKey = openssl_pkey_get_public ( file_get_contents ( $ this -> projectDir . '/var/jwt/public.pem' ) ) ; $ jws = SimpleJWS :: load ( $ token ) ; return $ jws -> verify ( $ publicKey , self :: ALG ) && $ this -> isTokenNotExpired ( $ token ) ; } catch ( \ InvalidArgumentException $ ex ) { return false ; } }
Returns true if the token is valid

@param string $token
@return bool
Returns true if the token is valid