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

EncryptionInstruction   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 53
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRecipientKey() 0 4 1
A getSenderKey() 0 4 1
A getRecipientUnprotectedHeader() 0 4 1
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