Пример #1
0
 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();
 }
Пример #2
0
 /**
  * @covers ::getEncoded
  */
 public function testNotSettingKeysFails()
 {
     $tok = new JWT(['data' => true]);
     $this->expectException(BadMethodCallException::class);
     $tok->getEncoded();
 }