for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2015 Spomky-Labs
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace Jose\Object;
/**
* Class EncryptionInstruction.
final class Recipient implements RecipientInterface
{
* @var array
private $headers = [];
* @var null|string
private $encrypted_key = null;
* {@inheritdoc}
public function getHeaders()
return $this->headers;
}
public function withHeaders(array $headers)
$signature = clone $this;
$signature->headers = $headers;
return $signature;
public function withHeader($key, $value)
$signature->headers[$key] = $value;
public function getHeader($key)
if ($this->hasHeader($key)) {
return $this->headers[$key];
throw new \InvalidArgumentException(sprintf('The header "%s" does not exist', $key));
public function hasHeader($key)
return array_key_exists($key, $this->headers);
public function getEncryptedKey()
return $this->encrypted_key;
public function withEncryptedKey($encrypted_key)
$recipient = clone $this;
$recipient->encrypted_key = $encrypted_key;
return $recipient;