Jose\Object\JWKSet::addKey PHP Méthode

addKey() public méthode

public addKey ( Jose\Object\JWKInterface $key )
$key Jose\Object\JWKInterface
    public function addKey(JWKInterface $key)
    {
        $this->keys[] = $key;
    }

Usage Example

Exemple #1
0
 /**
  * @return \Jose\Object\JWKInterface[]
  */
 public function getKeys()
 {
     $content = json_decode($this->getContent(), true);
     Assertion::isArray($content, 'Invalid content.');
     $jwkset = new JWKSet();
     foreach ($content as $kid => $cert) {
         $jwk = KeyConverter::loadKeyFromCertificate($cert);
         Assertion::notEmpty($jwk, 'Invalid content.');
         if (is_string($kid)) {
             $jwk['kid'] = $kid;
         }
         $jwkset->addKey(new JWK($jwk));
     }
     return $jwkset->getKeys();
 }
All Usage Examples Of Jose\Object\JWKSet::addKey