public function getEncodedToken() : string { if (!$this->keys) { throw new BadMethodCallException('call setKeys() before getEncodedToken()'); } $jwt = new JWT($this->getDataForJWT()); $jwt->setKeys($this->keys); return $jwt->getEncoded(); }
/** * @covers ::getEncoded */ public function testNotSettingKeysFails() { $tok = new JWT(['data' => true]); $this->expectException(BadMethodCallException::class); $tok->getEncoded(); }