Completed
Push — master ( 668fd8...cdc0a6 )
by Florent
12:11
created

JWE::getCiphertext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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\Object;
13
14
/**
15
 * Class JWE.
16
 */
17
final class JWE extends JWT implements JWEInterface
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $ciphertext = null;
23
24
    /**
25
     * @var string|null
26
     */
27
    private $encrypted_key = null;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $iv = null;
33
34
    /**
35
     * @var string|null
36
     */
37
    private $aad = null;
38
39
    /**
40
     * @var string|null
41
     */
42
    private $tag = null;
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getEncryptionAlgorithm()
48
    {
49
        return $this->getHeaderValue('enc');
0 ignored issues
show
Bug introduced by
The method getHeaderValue() does not exist on Jose\Object\JWE. Did you maybe mean getHeader()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getZip()
56
    {
57
        return $this->getHeaderValue('zip');
0 ignored issues
show
Bug introduced by
The method getHeaderValue() does not exist on Jose\Object\JWE. Did you maybe mean getHeader()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function getCiphertext()
64
    {
65
        return $this->ciphertext;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function withCiphertext($ciphertext)
72
    {
73
        $jwe = clone $this;
74
        $jwe->ciphertext = $ciphertext;
75
76
        return $jwe;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function getEncryptedKey()
83
    {
84
        return $this->encrypted_key;
85
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function withEncryptedKey($encrypted_key)
91
    {
92
        $jwe = clone $this;
93
        $jwe->encrypted_key = $encrypted_key;
94
95
        return $jwe;
96
    }
97
98
    /**
99
     * {@inheritdoc}
100
     */
101
    public function getAAD()
102
    {
103
        return $this->aad;
104
    }
105
106
    /**
107
     * {@inheritdoc}
108
     */
109
    public function withAAD($aad)
110
    {
111
        $jwe = clone $this;
112
        $jwe->aad = $aad;
113
114
        return $jwe;
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function getIV()
121
    {
122
        return $this->iv;
123
    }
124
125
    /**
126
     * {@inheritdoc}
127
     */
128
    public function withIV($iv)
129
    {
130
        $jwe = clone $this;
131
        $jwe->iv = $iv;
132
133
        return $jwe;
134
    }
135
136
    /**
137
     * {@inheritdoc}
138
     */
139
    public function getTag()
140
    {
141
        return $this->tag;
142
    }
143
144
    /**
145
     * {@inheritdoc}
146
     */
147
    public function withTag($tag)
148
    {
149
        $jwe = clone $this;
150
        $jwe->tag = $tag;
151
152
        return $jwe;
153
    }
154
}
155