Jose\Object\Recipient::createRecipient PHP Méthode

createRecipient() public static méthode

public static createRecipient ( Jose\Object\JWKInterface $recipient_key, array $headers = [] )
$recipient_key Jose\Object\JWKInterface
$headers array
    public static function createRecipient(JWKInterface $recipient_key, array $headers = [])
    {
        $recipient = new self();
        $recipient->headers = $headers;
        $recipient->recipient_key = $recipient_key;
        return $recipient;
    }

Usage Example

Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function addRecipientInformation(JWKInterface $recipient_key, $recipient_headers = [])
 {
     Assertion::true(null === $this->getCiphertext(), 'The JWE is encrypted. No additional recipient allowed.');
     $jwe = clone $this;
     $jwe->recipients[] = Recipient::createRecipient($recipient_key, $recipient_headers);
     return $jwe;
 }