Completed
Push — master ( f67525...5cf1da )
by Florent
02:34
created

EncryptionInstruction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4286
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2015 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose;
13
14
/**
15
 * Class EncryptionInstruction.
16
 */
17
class EncryptionInstruction implements EncryptionInstructionInterface
18
{
19
    /**
20
     * @var array
21
     */
22
    protected $recipient_unprotected_header = [];
23
    /**
24
     * @var \Jose\JWKInterface
25
     */
26
    protected $recipient_public_key;
27
    /**
28
     * @var null|\Jose\JWKInterface
29
     */
30
    protected $sender_private_key = null;
31
32
    /**
33
     * EncryptionInstruction constructor.
34
     *
35
     * @param \Jose\JWKInterface      $recipient_public_key
36
     * @param \Jose\JWKInterface|null $sender_private_key
37
     * @param array                   $recipient_unprotected_header
38
     */
39
    public function __construct(JWKInterface $recipient_public_key, JWKInterface $sender_private_key = null, array $recipient_unprotected_header = [])
40
    {
41
        $this->sender_private_key = $sender_private_key;
42
        $this->recipient_public_key = $recipient_public_key;
43
        $this->recipient_unprotected_header = $recipient_unprotected_header;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getRecipientKey()
50
    {
51
        return $this->recipient_public_key;
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function getSenderKey()
58
    {
59
        return $this->sender_private_key;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function getRecipientUnprotectedHeader()
66
    {
67
        return $this->recipient_unprotected_header;
68
    }
69
}
70