GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( e271c1...debdfc )
by Joni
06:33
created
lib/JWX/JWT/Header/JOSE.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -15,54 +15,54 @@
 block discarded – undo
15 15
  */
16 16
 class JOSE extends Header
17 17
 {
18
-    /**
19
-     * Constructor.
20
-     *
21
-     * @param Header ...$headers One or more headers to merge
22
-     */
23
-    public function __construct(Header ...$headers)
24
-    {
25
-        $params = [];
26
-        foreach ($headers as $header) {
27
-            foreach ($header->parameters() as $param) {
28
-                if (isset($params[$param->name()])) {
29
-                    throw new \UnexpectedValueException('Duplicate parameter.');
30
-                }
31
-                $params[$param->name()] = $param;
32
-            }
33
-        }
34
-        parent::__construct(...array_values($params));
35
-    }
18
+	/**
19
+	 * Constructor.
20
+	 *
21
+	 * @param Header ...$headers One or more headers to merge
22
+	 */
23
+	public function __construct(Header ...$headers)
24
+	{
25
+		$params = [];
26
+		foreach ($headers as $header) {
27
+			foreach ($header->parameters() as $param) {
28
+				if (isset($params[$param->name()])) {
29
+					throw new \UnexpectedValueException('Duplicate parameter.');
30
+				}
31
+				$params[$param->name()] = $param;
32
+			}
33
+		}
34
+		parent::__construct(...array_values($params));
35
+	}
36 36
 
37
-    /**
38
-     * Get self merged with another Header.
39
-     *
40
-     * @param Header $header
41
-     *
42
-     * @return self
43
-     */
44
-    public function withHeader(Header $header): self
45
-    {
46
-        return new self($this, $header);
47
-    }
37
+	/**
38
+	 * Get self merged with another Header.
39
+	 *
40
+	 * @param Header $header
41
+	 *
42
+	 * @return self
43
+	 */
44
+	public function withHeader(Header $header): self
45
+	{
46
+		return new self($this, $header);
47
+	}
48 48
 
49
-    /**
50
-     * Whether JOSE is for a JWS.
51
-     *
52
-     * @return bool
53
-     */
54
-    public function isJWS(): bool
55
-    {
56
-        return $this->hasAlgorithm() && !$this->hasEncryptionAlgorithm();
57
-    }
49
+	/**
50
+	 * Whether JOSE is for a JWS.
51
+	 *
52
+	 * @return bool
53
+	 */
54
+	public function isJWS(): bool
55
+	{
56
+		return $this->hasAlgorithm() && !$this->hasEncryptionAlgorithm();
57
+	}
58 58
 
59
-    /**
60
-     * Whether JOSE is for a JWE.
61
-     *
62
-     * @return bool
63
-     */
64
-    public function isJWE(): bool
65
-    {
66
-        return $this->hasEncryptionAlgorithm();
67
-    }
59
+	/**
60
+	 * Whether JOSE is for a JWE.
61
+	 *
62
+	 * @return bool
63
+	 */
64
+	public function isJWE(): bool
65
+	{
66
+		return $this->hasEncryptionAlgorithm();
67
+	}
68 68
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Header/Header.php 1 patch
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -11,162 +11,162 @@
 block discarded – undo
11 11
  */
12 12
 class Header implements \Countable, \IteratorAggregate
13 13
 {
14
-    use TypedHeader;
14
+	use TypedHeader;
15 15
 
16
-    /**
17
-     * Parameters.
18
-     *
19
-     * @var JWTParameter[]
20
-     */
21
-    protected $_parameters;
16
+	/**
17
+	 * Parameters.
18
+	 *
19
+	 * @var JWTParameter[]
20
+	 */
21
+	protected $_parameters;
22 22
 
23
-    /**
24
-     * Constructor.
25
-     *
26
-     * @param JWTParameter ...$params Parameters
27
-     */
28
-    public function __construct(JWTParameter ...$params)
29
-    {
30
-        $this->_parameters = [];
31
-        foreach ($params as $param) {
32
-            $this->_parameters[$param->name()] = $param;
33
-        }
34
-    }
23
+	/**
24
+	 * Constructor.
25
+	 *
26
+	 * @param JWTParameter ...$params Parameters
27
+	 */
28
+	public function __construct(JWTParameter ...$params)
29
+	{
30
+		$this->_parameters = [];
31
+		foreach ($params as $param) {
32
+			$this->_parameters[$param->name()] = $param;
33
+		}
34
+	}
35 35
 
36
-    /**
37
-     * Initialize from an array representing a JSON object.
38
-     *
39
-     * @param array $members
40
-     *
41
-     * @return self
42
-     */
43
-    public static function fromArray(array $members): self
44
-    {
45
-        $params = [];
46
-        foreach ($members as $name => $value) {
47
-            $params[] = JWTParameter::fromNameAndValue($name, $value);
48
-        }
49
-        return new self(...$params);
50
-    }
36
+	/**
37
+	 * Initialize from an array representing a JSON object.
38
+	 *
39
+	 * @param array $members
40
+	 *
41
+	 * @return self
42
+	 */
43
+	public static function fromArray(array $members): self
44
+	{
45
+		$params = [];
46
+		foreach ($members as $name => $value) {
47
+			$params[] = JWTParameter::fromNameAndValue($name, $value);
48
+		}
49
+		return new self(...$params);
50
+	}
51 51
 
52
-    /**
53
-     * Initialize from a JSON.
54
-     *
55
-     * @param string $json
56
-     *
57
-     * @throws \UnexpectedValueException
58
-     *
59
-     * @return self
60
-     */
61
-    public static function fromJSON(string $json): self
62
-    {
63
-        $members = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
64
-        if (!is_array($members)) {
65
-            throw new \UnexpectedValueException('Invalid JSON.');
66
-        }
67
-        return self::fromArray($members);
68
-    }
52
+	/**
53
+	 * Initialize from a JSON.
54
+	 *
55
+	 * @param string $json
56
+	 *
57
+	 * @throws \UnexpectedValueException
58
+	 *
59
+	 * @return self
60
+	 */
61
+	public static function fromJSON(string $json): self
62
+	{
63
+		$members = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
64
+		if (!is_array($members)) {
65
+			throw new \UnexpectedValueException('Invalid JSON.');
66
+		}
67
+		return self::fromArray($members);
68
+	}
69 69
 
70
-    /**
71
-     * Get self with parameters added.
72
-     *
73
-     * @param JWTParameter ...$param
74
-     *
75
-     * @return self
76
-     */
77
-    public function withParameters(JWTParameter ...$params): self
78
-    {
79
-        $obj = clone $this;
80
-        foreach ($params as $param) {
81
-            $obj->_parameters[$param->name()] = $param;
82
-        }
83
-        return $obj;
84
-    }
70
+	/**
71
+	 * Get self with parameters added.
72
+	 *
73
+	 * @param JWTParameter ...$param
74
+	 *
75
+	 * @return self
76
+	 */
77
+	public function withParameters(JWTParameter ...$params): self
78
+	{
79
+		$obj = clone $this;
80
+		foreach ($params as $param) {
81
+			$obj->_parameters[$param->name()] = $param;
82
+		}
83
+		return $obj;
84
+	}
85 85
 
86
-    /**
87
-     * Get all parameters.
88
-     *
89
-     * @return JWTParameter[]
90
-     */
91
-    public function parameters(): array
92
-    {
93
-        return $this->_parameters;
94
-    }
86
+	/**
87
+	 * Get all parameters.
88
+	 *
89
+	 * @return JWTParameter[]
90
+	 */
91
+	public function parameters(): array
92
+	{
93
+		return $this->_parameters;
94
+	}
95 95
 
96
-    /**
97
-     * Whether parameters are present.
98
-     *
99
-     * Returns false if any of the given parameters is not set.
100
-     *
101
-     * @param string ...$names Parameter names
102
-     *
103
-     * @return bool
104
-     */
105
-    public function has(string ...$names): bool
106
-    {
107
-        foreach ($names as $name) {
108
-            if (!isset($this->_parameters[$name])) {
109
-                return false;
110
-            }
111
-        }
112
-        return true;
113
-    }
96
+	/**
97
+	 * Whether parameters are present.
98
+	 *
99
+	 * Returns false if any of the given parameters is not set.
100
+	 *
101
+	 * @param string ...$names Parameter names
102
+	 *
103
+	 * @return bool
104
+	 */
105
+	public function has(string ...$names): bool
106
+	{
107
+		foreach ($names as $name) {
108
+			if (!isset($this->_parameters[$name])) {
109
+				return false;
110
+			}
111
+		}
112
+		return true;
113
+	}
114 114
 
115
-    /**
116
-     * Get a parameter.
117
-     *
118
-     * @param string $name Parameter name
119
-     *
120
-     * @throws \LogicException
121
-     *
122
-     * @return JWTParameter
123
-     */
124
-    public function get(string $name): JWTParameter
125
-    {
126
-        if (!$this->has($name)) {
127
-            throw new \LogicException("Parameter {$name} doesn't exists.");
128
-        }
129
-        return $this->_parameters[$name];
130
-    }
115
+	/**
116
+	 * Get a parameter.
117
+	 *
118
+	 * @param string $name Parameter name
119
+	 *
120
+	 * @throws \LogicException
121
+	 *
122
+	 * @return JWTParameter
123
+	 */
124
+	public function get(string $name): JWTParameter
125
+	{
126
+		if (!$this->has($name)) {
127
+			throw new \LogicException("Parameter {$name} doesn't exists.");
128
+		}
129
+		return $this->_parameters[$name];
130
+	}
131 131
 
132
-    /**
133
-     * Convert to a JSON.
134
-     *
135
-     * @return string
136
-     */
137
-    public function toJSON(): string
138
-    {
139
-        if (empty($this->_parameters)) {
140
-            return '';
141
-        }
142
-        $data = [];
143
-        foreach ($this->_parameters as $param) {
144
-            $data[$param->name()] = $param->value();
145
-        }
146
-        return json_encode((object) $data, JSON_UNESCAPED_SLASHES);
147
-    }
132
+	/**
133
+	 * Convert to a JSON.
134
+	 *
135
+	 * @return string
136
+	 */
137
+	public function toJSON(): string
138
+	{
139
+		if (empty($this->_parameters)) {
140
+			return '';
141
+		}
142
+		$data = [];
143
+		foreach ($this->_parameters as $param) {
144
+			$data[$param->name()] = $param->value();
145
+		}
146
+		return json_encode((object) $data, JSON_UNESCAPED_SLASHES);
147
+	}
148 148
 
149
-    /**
150
-     * Get the number of parameters.
151
-     *
152
-     * @see \Countable::count()
153
-     *
154
-     * @return int
155
-     */
156
-    public function count(): int
157
-    {
158
-        return count($this->_parameters);
159
-    }
149
+	/**
150
+	 * Get the number of parameters.
151
+	 *
152
+	 * @see \Countable::count()
153
+	 *
154
+	 * @return int
155
+	 */
156
+	public function count(): int
157
+	{
158
+		return count($this->_parameters);
159
+	}
160 160
 
161
-    /**
162
-     * Get iterator for the parameters.
163
-     *
164
-     * @see \IteratorAggregate::getIterator()
165
-     *
166
-     * @return \ArrayIterator
167
-     */
168
-    public function getIterator(): \ArrayIterator
169
-    {
170
-        return new \ArrayIterator($this->_parameters);
171
-    }
161
+	/**
162
+	 * Get iterator for the parameters.
163
+	 *
164
+	 * @see \IteratorAggregate::getIterator()
165
+	 *
166
+	 * @return \ArrayIterator
167
+	 */
168
+	public function getIterator(): \ArrayIterator
169
+	{
170
+		return new \ArrayIterator($this->_parameters);
171
+	}
172 172
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Header/HeaderParameters.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
  */
12 12
 interface HeaderParameters
13 13
 {
14
-    /**
15
-     * Get an array of JOSE header parameters representing this object.
16
-     *
17
-     * @return JWTParameter[]
18
-     */
19
-    public function headerParameters(): array;
14
+	/**
15
+	 * Get an array of JOSE header parameters representing this object.
16
+	 *
17
+	 * @return JWTParameter[]
18
+	 */
19
+	public function headerParameters(): array;
20 20
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Header/TypedHeader.php 1 patch
Indentation   +472 added lines, -472 removed lines patch added patch discarded remove patch
@@ -13,476 +13,476 @@
 block discarded – undo
13 13
  */
14 14
 trait TypedHeader
15 15
 {
16
-    /**
17
-     * Whether parameters are present.
18
-     *
19
-     * @param string ...$names Parameter names
20
-     *
21
-     * @return bool
22
-     */
23
-    abstract public function has(string ...$names): bool;
24
-
25
-    /**
26
-     * Get a parameter.
27
-     *
28
-     * @param string $name Parameter name
29
-     *
30
-     * @throws \LogicException If the parameter is not present
31
-     *
32
-     * @return JWTParameter
33
-     */
34
-    abstract public function get(string $name): JWTParameter;
35
-
36
-    /**
37
-     * Check whether the algorithm parameter is present.
38
-     *
39
-     * @return bool
40
-     */
41
-    public function hasAlgorithm(): bool
42
-    {
43
-        return $this->has(Parameter\JWTParameter::P_ALG);
44
-    }
45
-
46
-    /**
47
-     * Get the algorithm parameter.
48
-     *
49
-     * @throws \UnexpectedValueException If the parameter has a wrong class
50
-     * @throws \LogicException           If the parameter is not present
51
-     *
52
-     * @return \Sop\JWX\JWT\Parameter\AlgorithmParameter
53
-     */
54
-    public function algorithm(): Parameter\AlgorithmParameter
55
-    {
56
-        return self::_checkType($this->get(Parameter\JWTParameter::P_ALG),
57
-            Parameter\AlgorithmParameter::class);
58
-    }
59
-
60
-    /**
61
-     * Check whether the authentication tag parameter is present.
62
-     *
63
-     * @return bool
64
-     */
65
-    public function hasAuthenticationTag(): bool
66
-    {
67
-        return $this->has(Parameter\JWTParameter::P_TAG);
68
-    }
69
-
70
-    /**
71
-     * Get the authentication tag parameter.
72
-     *
73
-     * @throws \UnexpectedValueException If the parameter has a wrong class
74
-     * @throws \LogicException           If the parameter is not present
75
-     *
76
-     * @return \Sop\JWX\JWT\Parameter\AuthenticationTagParameter
77
-     */
78
-    public function authenticationTag(): Parameter\AuthenticationTagParameter
79
-    {
80
-        return self::_checkType($this->get(Parameter\JWTParameter::P_TAG),
81
-            Parameter\AuthenticationTagParameter::class);
82
-    }
83
-
84
-    /**
85
-     * Check whether the 'base64url-encode payload' parameter is present.
86
-     *
87
-     * @return bool
88
-     */
89
-    public function hasB64Payload(): bool
90
-    {
91
-        return $this->has(Parameter\JWTParameter::P_B64);
92
-    }
93
-
94
-    /**
95
-     * Get the 'base64url-encode payload' parameter.
96
-     *
97
-     * @throws \UnexpectedValueException If the parameter has a wrong class
98
-     * @throws \LogicException           If the parameter is not present
99
-     *
100
-     * @return \Sop\JWX\JWT\Parameter\B64PayloadParameter
101
-     */
102
-    public function B64Payload(): Parameter\B64PayloadParameter
103
-    {
104
-        return self::_checkType($this->get(Parameter\JWTParameter::P_B64),
105
-            Parameter\B64PayloadParameter::class);
106
-    }
107
-
108
-    /**
109
-     * Check whether the compression algorithm parameter is present.
110
-     *
111
-     * @return bool
112
-     */
113
-    public function hasCompressionAlgorithm(): bool
114
-    {
115
-        return $this->has(Parameter\JWTParameter::P_ZIP);
116
-    }
117
-
118
-    /**
119
-     * Get the compression algorithm parameter.
120
-     *
121
-     * @throws \UnexpectedValueException If the parameter has a wrong class
122
-     * @throws \LogicException           If the parameter is not present
123
-     *
124
-     * @return \Sop\JWX\JWT\Parameter\CompressionAlgorithmParameter
125
-     */
126
-    public function compressionAlgorithm(): Parameter\CompressionAlgorithmParameter
127
-    {
128
-        return self::_checkType($this->get(Parameter\JWTParameter::P_ZIP),
129
-            Parameter\CompressionAlgorithmParameter::class);
130
-    }
131
-
132
-    /**
133
-     * Check whether the content type parameter is present.
134
-     *
135
-     * @return bool
136
-     */
137
-    public function hasContentType(): bool
138
-    {
139
-        return $this->has(Parameter\JWTParameter::P_CTY);
140
-    }
141
-
142
-    /**
143
-     * Get the content type parameter.
144
-     *
145
-     * @throws \UnexpectedValueException If the parameter has a wrong class
146
-     * @throws \LogicException           If the parameter is not present
147
-     *
148
-     * @return \Sop\JWX\JWT\Parameter\ContentTypeParameter
149
-     */
150
-    public function contentType(): Parameter\ContentTypeParameter
151
-    {
152
-        return self::_checkType($this->get(Parameter\JWTParameter::P_CTY),
153
-            Parameter\ContentTypeParameter::class);
154
-    }
155
-
156
-    /**
157
-     * Check whether the critical parameter is present.
158
-     *
159
-     * @return bool
160
-     */
161
-    public function hasCritical(): bool
162
-    {
163
-        return $this->has(Parameter\JWTParameter::P_CRIT);
164
-    }
165
-
166
-    /**
167
-     * Get the critical parameter.
168
-     *
169
-     * @throws \UnexpectedValueException If the parameter has a wrong class
170
-     * @throws \LogicException           If the parameter is not present
171
-     *
172
-     * @return \Sop\JWX\JWT\Parameter\CriticalParameter
173
-     */
174
-    public function critical(): Parameter\CriticalParameter
175
-    {
176
-        return self::_checkType($this->get(Parameter\JWTParameter::P_CRIT),
177
-            Parameter\CriticalParameter::class);
178
-    }
179
-
180
-    /**
181
-     * Check whether the encryption algorithm parameter is present.
182
-     *
183
-     * @return bool
184
-     */
185
-    public function hasEncryptionAlgorithm(): bool
186
-    {
187
-        return $this->has(Parameter\JWTParameter::P_ENC);
188
-    }
189
-
190
-    /**
191
-     * Get the encryption algorithm parameter.
192
-     *
193
-     * @throws \UnexpectedValueException If the parameter has a wrong class
194
-     * @throws \LogicException           If the parameter is not present
195
-     *
196
-     * @return \Sop\JWX\JWT\Parameter\EncryptionAlgorithmParameter
197
-     */
198
-    public function encryptionAlgorithm(): Parameter\EncryptionAlgorithmParameter
199
-    {
200
-        return self::_checkType($this->get(Parameter\JWTParameter::P_ENC),
201
-            Parameter\EncryptionAlgorithmParameter::class);
202
-    }
203
-
204
-    /**
205
-     * Check whether the initialization vector parameter is present.
206
-     *
207
-     * @return bool
208
-     */
209
-    public function hasInitializationVector(): bool
210
-    {
211
-        return $this->has(Parameter\JWTParameter::P_IV);
212
-    }
213
-
214
-    /**
215
-     * Get the initialization vector parameter.
216
-     *
217
-     * @throws \UnexpectedValueException If the parameter has a wrong class
218
-     * @throws \LogicException           If the parameter is not present
219
-     *
220
-     * @return \Sop\JWX\JWT\Parameter\InitializationVectorParameter
221
-     */
222
-    public function initializationVector(): Parameter\InitializationVectorParameter
223
-    {
224
-        return self::_checkType($this->get(Parameter\JWTParameter::P_IV),
225
-            Parameter\InitializationVectorParameter::class);
226
-    }
227
-
228
-    /**
229
-     * Check whether the JSON web key parameter is present.
230
-     *
231
-     * @return bool
232
-     */
233
-    public function hasJSONWebKey(): bool
234
-    {
235
-        return $this->has(Parameter\JWTParameter::P_JWK);
236
-    }
237
-
238
-    /**
239
-     * Get the JSON web key parameter.
240
-     *
241
-     * @throws \UnexpectedValueException If the parameter has a wrong class
242
-     * @throws \LogicException           If the parameter is not present
243
-     *
244
-     * @return \Sop\JWX\JWT\Parameter\JSONWebKeyParameter
245
-     */
246
-    public function JSONWebKey(): Parameter\JSONWebKeyParameter
247
-    {
248
-        return self::_checkType($this->get(Parameter\JWTParameter::P_JWK),
249
-            Parameter\JSONWebKeyParameter::class);
250
-    }
251
-
252
-    /**
253
-     * Check whether the JWK set URL parameter is present.
254
-     *
255
-     * @return bool
256
-     */
257
-    public function hasJWKSetURL(): bool
258
-    {
259
-        return $this->has(Parameter\JWTParameter::P_JKU);
260
-    }
261
-
262
-    /**
263
-     * Get the JWK set URL parameter.
264
-     *
265
-     * @throws \UnexpectedValueException If the parameter has a wrong class
266
-     * @throws \LogicException           If the parameter is not present
267
-     *
268
-     * @return \Sop\JWX\JWT\Parameter\JWKSetURLParameter
269
-     */
270
-    public function JWKSetURL(): Parameter\JWKSetURLParameter
271
-    {
272
-        return self::_checkType($this->get(Parameter\JWTParameter::P_JKU),
273
-            Parameter\JWKSetURLParameter::class);
274
-    }
275
-
276
-    /**
277
-     * Check whether the key ID parameter is present.
278
-     *
279
-     * @return bool
280
-     */
281
-    public function hasKeyID(): bool
282
-    {
283
-        return $this->has(Parameter\JWTParameter::P_KID);
284
-    }
285
-
286
-    /**
287
-     * Get the key ID parameter.
288
-     *
289
-     * @throws \UnexpectedValueException If the parameter has a wrong class
290
-     * @throws \LogicException           If the parameter is not present
291
-     *
292
-     * @return \Sop\JWX\JWT\Parameter\KeyIDParameter
293
-     */
294
-    public function keyID(): Parameter\KeyIDParameter
295
-    {
296
-        return self::_checkType($this->get(Parameter\JWTParameter::P_KID),
297
-            Parameter\KeyIDParameter::class);
298
-    }
299
-
300
-    /**
301
-     * Check whether the PBES2 count parameter is present.
302
-     *
303
-     * @return bool
304
-     */
305
-    public function hasPBES2Count(): bool
306
-    {
307
-        return $this->has(Parameter\JWTParameter::P_P2C);
308
-    }
309
-
310
-    /**
311
-     * Get the PBES2 count parameter.
312
-     *
313
-     * @throws \UnexpectedValueException If the parameter has a wrong class
314
-     * @throws \LogicException           If the parameter is not present
315
-     *
316
-     * @return \Sop\JWX\JWT\Parameter\PBES2CountParameter
317
-     */
318
-    public function PBES2Count(): Parameter\PBES2CountParameter
319
-    {
320
-        return self::_checkType($this->get(Parameter\JWTParameter::P_P2C),
321
-            Parameter\PBES2CountParameter::class);
322
-    }
323
-
324
-    /**
325
-     * Check whether the PBES2 salt input parameter is present.
326
-     *
327
-     * @return bool
328
-     */
329
-    public function hasPBES2SaltInput(): bool
330
-    {
331
-        return $this->has(Parameter\JWTParameter::P_P2S);
332
-    }
333
-
334
-    /**
335
-     * Get the PBES2 salt input parameter.
336
-     *
337
-     * @throws \UnexpectedValueException If the parameter has a wrong class
338
-     * @throws \LogicException           If the parameter is not present
339
-     *
340
-     * @return \Sop\JWX\JWT\Parameter\PBES2SaltInputParameter
341
-     */
342
-    public function PBES2SaltInput(): Parameter\PBES2SaltInputParameter
343
-    {
344
-        return self::_checkType($this->get(Parameter\JWTParameter::P_P2S),
345
-            Parameter\PBES2SaltInputParameter::class);
346
-    }
347
-
348
-    /**
349
-     * Check whether the type parameter is present.
350
-     *
351
-     * @return bool
352
-     */
353
-    public function hasType(): bool
354
-    {
355
-        return $this->has(Parameter\JWTParameter::P_TYP);
356
-    }
357
-
358
-    /**
359
-     * Get the type parameter.
360
-     *
361
-     * @throws \UnexpectedValueException If the parameter has a wrong class
362
-     * @throws \LogicException           If the parameter is not present
363
-     *
364
-     * @return \Sop\JWX\JWT\Parameter\TypeParameter
365
-     */
366
-    public function type(): Parameter\TypeParameter
367
-    {
368
-        return self::_checkType($this->get(Parameter\JWTParameter::P_TYP),
369
-            Parameter\TypeParameter::class);
370
-    }
371
-
372
-    /**
373
-     * Check whether the X.509 certificate chain parameter is present.
374
-     *
375
-     * @return bool
376
-     */
377
-    public function hasX509CertificateChain(): bool
378
-    {
379
-        return $this->has(Parameter\JWTParameter::P_X5C);
380
-    }
381
-
382
-    /**
383
-     * Get the X.509 certificate chain parameter.
384
-     *
385
-     * @throws \UnexpectedValueException If the parameter has a wrong class
386
-     * @throws \LogicException           If the parameter is not present
387
-     *
388
-     * @return \Sop\JWX\JWT\Parameter\X509CertificateChainParameter
389
-     */
390
-    public function X509CertificateChain(): Parameter\X509CertificateChainParameter
391
-    {
392
-        return self::_checkType($this->get(Parameter\JWTParameter::P_X5C),
393
-            Parameter\X509CertificateChainParameter::class);
394
-    }
395
-
396
-    /**
397
-     * Check whether the X.509 certificate SHA-1 thumbprint parameter is
398
-     * present.
399
-     *
400
-     * @return bool
401
-     */
402
-    public function hasX509CertificateSHA1Thumbprint(): bool
403
-    {
404
-        return $this->has(Parameter\JWTParameter::P_X5T);
405
-    }
406
-
407
-    /**
408
-     * Get the X.509 certificate SHA-1 thumbprint parameter.
409
-     *
410
-     * @throws \UnexpectedValueException If the parameter has a wrong class
411
-     * @throws \LogicException           If the parameter is not present
412
-     *
413
-     * @return \Sop\JWX\JWT\Parameter\X509CertificateSHA1ThumbprintParameter
414
-     */
415
-    public function X509CertificateSHA1Thumbprint(): Parameter\X509CertificateSHA1ThumbprintParameter
416
-    {
417
-        return self::_checkType($this->get(Parameter\JWTParameter::P_X5T),
418
-            Parameter\X509CertificateSHA1ThumbprintParameter::class);
419
-    }
420
-
421
-    /**
422
-     * Check whether the X.509 certificate SHA-256 thumbprint parameter is
423
-     * present.
424
-     *
425
-     * @return bool
426
-     */
427
-    public function hasX509CertificateSHA256Thumbprint(): bool
428
-    {
429
-        return $this->has(Parameter\JWTParameter::P_X5TS256);
430
-    }
431
-
432
-    /**
433
-     * Get the X.509 certificate SHA-256 thumbprint parameter.
434
-     *
435
-     * @throws \UnexpectedValueException If the parameter has a wrong class
436
-     * @throws \LogicException           If the parameter is not present
437
-     *
438
-     * @return \Sop\JWX\JWT\Parameter\X509CertificateSHA256ThumbprintParameter
439
-     */
440
-    public function X509CertificateSHA256Thumbprint(): Parameter\X509CertificateSHA256ThumbprintParameter
441
-    {
442
-        return self::_checkType($this->get(Parameter\JWTParameter::P_X5TS256),
443
-            Parameter\X509CertificateSHA256ThumbprintParameter::class);
444
-    }
445
-
446
-    /**
447
-     * Check whether the X.509 URL parameter is present.
448
-     *
449
-     * @return bool
450
-     */
451
-    public function hasX509URL(): bool
452
-    {
453
-        return $this->has(Parameter\JWTParameter::P_X5U);
454
-    }
455
-
456
-    /**
457
-     * Get the X.509 URL parameter.
458
-     *
459
-     * @throws \UnexpectedValueException If the parameter has a wrong class
460
-     * @throws \LogicException           If the parameter is not present
461
-     *
462
-     * @return \Sop\JWX\JWT\Parameter\X509URLParameter
463
-     */
464
-    public function X509URL(): Parameter\X509URLParameter
465
-    {
466
-        return self::_checkType($this->get(Parameter\JWTParameter::P_X5U),
467
-            Parameter\X509URLParameter::class);
468
-    }
469
-
470
-    /**
471
-     * Check that the parameter is an instance of the given class.
472
-     *
473
-     * @param \Sop\JWX\JWT\Parameter\JWTParameter $param Parameter
474
-     * @param string                              $cls   Class name
475
-     *
476
-     * @throws \UnexpectedValueException
477
-     *
478
-     * @return \Sop\JWX\JWT\Parameter\JWTParameter
479
-     */
480
-    private static function _checkType(Parameter\JWTParameter $param, string $cls): Parameter\JWTParameter
481
-    {
482
-        if (!$param instanceof $cls) {
483
-            throw new \UnexpectedValueException(
484
-                "{$cls} expected, got " . get_class($param));
485
-        }
486
-        return $param;
487
-    }
16
+	/**
17
+	 * Whether parameters are present.
18
+	 *
19
+	 * @param string ...$names Parameter names
20
+	 *
21
+	 * @return bool
22
+	 */
23
+	abstract public function has(string ...$names): bool;
24
+
25
+	/**
26
+	 * Get a parameter.
27
+	 *
28
+	 * @param string $name Parameter name
29
+	 *
30
+	 * @throws \LogicException If the parameter is not present
31
+	 *
32
+	 * @return JWTParameter
33
+	 */
34
+	abstract public function get(string $name): JWTParameter;
35
+
36
+	/**
37
+	 * Check whether the algorithm parameter is present.
38
+	 *
39
+	 * @return bool
40
+	 */
41
+	public function hasAlgorithm(): bool
42
+	{
43
+		return $this->has(Parameter\JWTParameter::P_ALG);
44
+	}
45
+
46
+	/**
47
+	 * Get the algorithm parameter.
48
+	 *
49
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
50
+	 * @throws \LogicException           If the parameter is not present
51
+	 *
52
+	 * @return \Sop\JWX\JWT\Parameter\AlgorithmParameter
53
+	 */
54
+	public function algorithm(): Parameter\AlgorithmParameter
55
+	{
56
+		return self::_checkType($this->get(Parameter\JWTParameter::P_ALG),
57
+			Parameter\AlgorithmParameter::class);
58
+	}
59
+
60
+	/**
61
+	 * Check whether the authentication tag parameter is present.
62
+	 *
63
+	 * @return bool
64
+	 */
65
+	public function hasAuthenticationTag(): bool
66
+	{
67
+		return $this->has(Parameter\JWTParameter::P_TAG);
68
+	}
69
+
70
+	/**
71
+	 * Get the authentication tag parameter.
72
+	 *
73
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
74
+	 * @throws \LogicException           If the parameter is not present
75
+	 *
76
+	 * @return \Sop\JWX\JWT\Parameter\AuthenticationTagParameter
77
+	 */
78
+	public function authenticationTag(): Parameter\AuthenticationTagParameter
79
+	{
80
+		return self::_checkType($this->get(Parameter\JWTParameter::P_TAG),
81
+			Parameter\AuthenticationTagParameter::class);
82
+	}
83
+
84
+	/**
85
+	 * Check whether the 'base64url-encode payload' parameter is present.
86
+	 *
87
+	 * @return bool
88
+	 */
89
+	public function hasB64Payload(): bool
90
+	{
91
+		return $this->has(Parameter\JWTParameter::P_B64);
92
+	}
93
+
94
+	/**
95
+	 * Get the 'base64url-encode payload' parameter.
96
+	 *
97
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
98
+	 * @throws \LogicException           If the parameter is not present
99
+	 *
100
+	 * @return \Sop\JWX\JWT\Parameter\B64PayloadParameter
101
+	 */
102
+	public function B64Payload(): Parameter\B64PayloadParameter
103
+	{
104
+		return self::_checkType($this->get(Parameter\JWTParameter::P_B64),
105
+			Parameter\B64PayloadParameter::class);
106
+	}
107
+
108
+	/**
109
+	 * Check whether the compression algorithm parameter is present.
110
+	 *
111
+	 * @return bool
112
+	 */
113
+	public function hasCompressionAlgorithm(): bool
114
+	{
115
+		return $this->has(Parameter\JWTParameter::P_ZIP);
116
+	}
117
+
118
+	/**
119
+	 * Get the compression algorithm parameter.
120
+	 *
121
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
122
+	 * @throws \LogicException           If the parameter is not present
123
+	 *
124
+	 * @return \Sop\JWX\JWT\Parameter\CompressionAlgorithmParameter
125
+	 */
126
+	public function compressionAlgorithm(): Parameter\CompressionAlgorithmParameter
127
+	{
128
+		return self::_checkType($this->get(Parameter\JWTParameter::P_ZIP),
129
+			Parameter\CompressionAlgorithmParameter::class);
130
+	}
131
+
132
+	/**
133
+	 * Check whether the content type parameter is present.
134
+	 *
135
+	 * @return bool
136
+	 */
137
+	public function hasContentType(): bool
138
+	{
139
+		return $this->has(Parameter\JWTParameter::P_CTY);
140
+	}
141
+
142
+	/**
143
+	 * Get the content type parameter.
144
+	 *
145
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
146
+	 * @throws \LogicException           If the parameter is not present
147
+	 *
148
+	 * @return \Sop\JWX\JWT\Parameter\ContentTypeParameter
149
+	 */
150
+	public function contentType(): Parameter\ContentTypeParameter
151
+	{
152
+		return self::_checkType($this->get(Parameter\JWTParameter::P_CTY),
153
+			Parameter\ContentTypeParameter::class);
154
+	}
155
+
156
+	/**
157
+	 * Check whether the critical parameter is present.
158
+	 *
159
+	 * @return bool
160
+	 */
161
+	public function hasCritical(): bool
162
+	{
163
+		return $this->has(Parameter\JWTParameter::P_CRIT);
164
+	}
165
+
166
+	/**
167
+	 * Get the critical parameter.
168
+	 *
169
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
170
+	 * @throws \LogicException           If the parameter is not present
171
+	 *
172
+	 * @return \Sop\JWX\JWT\Parameter\CriticalParameter
173
+	 */
174
+	public function critical(): Parameter\CriticalParameter
175
+	{
176
+		return self::_checkType($this->get(Parameter\JWTParameter::P_CRIT),
177
+			Parameter\CriticalParameter::class);
178
+	}
179
+
180
+	/**
181
+	 * Check whether the encryption algorithm parameter is present.
182
+	 *
183
+	 * @return bool
184
+	 */
185
+	public function hasEncryptionAlgorithm(): bool
186
+	{
187
+		return $this->has(Parameter\JWTParameter::P_ENC);
188
+	}
189
+
190
+	/**
191
+	 * Get the encryption algorithm parameter.
192
+	 *
193
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
194
+	 * @throws \LogicException           If the parameter is not present
195
+	 *
196
+	 * @return \Sop\JWX\JWT\Parameter\EncryptionAlgorithmParameter
197
+	 */
198
+	public function encryptionAlgorithm(): Parameter\EncryptionAlgorithmParameter
199
+	{
200
+		return self::_checkType($this->get(Parameter\JWTParameter::P_ENC),
201
+			Parameter\EncryptionAlgorithmParameter::class);
202
+	}
203
+
204
+	/**
205
+	 * Check whether the initialization vector parameter is present.
206
+	 *
207
+	 * @return bool
208
+	 */
209
+	public function hasInitializationVector(): bool
210
+	{
211
+		return $this->has(Parameter\JWTParameter::P_IV);
212
+	}
213
+
214
+	/**
215
+	 * Get the initialization vector parameter.
216
+	 *
217
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
218
+	 * @throws \LogicException           If the parameter is not present
219
+	 *
220
+	 * @return \Sop\JWX\JWT\Parameter\InitializationVectorParameter
221
+	 */
222
+	public function initializationVector(): Parameter\InitializationVectorParameter
223
+	{
224
+		return self::_checkType($this->get(Parameter\JWTParameter::P_IV),
225
+			Parameter\InitializationVectorParameter::class);
226
+	}
227
+
228
+	/**
229
+	 * Check whether the JSON web key parameter is present.
230
+	 *
231
+	 * @return bool
232
+	 */
233
+	public function hasJSONWebKey(): bool
234
+	{
235
+		return $this->has(Parameter\JWTParameter::P_JWK);
236
+	}
237
+
238
+	/**
239
+	 * Get the JSON web key parameter.
240
+	 *
241
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
242
+	 * @throws \LogicException           If the parameter is not present
243
+	 *
244
+	 * @return \Sop\JWX\JWT\Parameter\JSONWebKeyParameter
245
+	 */
246
+	public function JSONWebKey(): Parameter\JSONWebKeyParameter
247
+	{
248
+		return self::_checkType($this->get(Parameter\JWTParameter::P_JWK),
249
+			Parameter\JSONWebKeyParameter::class);
250
+	}
251
+
252
+	/**
253
+	 * Check whether the JWK set URL parameter is present.
254
+	 *
255
+	 * @return bool
256
+	 */
257
+	public function hasJWKSetURL(): bool
258
+	{
259
+		return $this->has(Parameter\JWTParameter::P_JKU);
260
+	}
261
+
262
+	/**
263
+	 * Get the JWK set URL parameter.
264
+	 *
265
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
266
+	 * @throws \LogicException           If the parameter is not present
267
+	 *
268
+	 * @return \Sop\JWX\JWT\Parameter\JWKSetURLParameter
269
+	 */
270
+	public function JWKSetURL(): Parameter\JWKSetURLParameter
271
+	{
272
+		return self::_checkType($this->get(Parameter\JWTParameter::P_JKU),
273
+			Parameter\JWKSetURLParameter::class);
274
+	}
275
+
276
+	/**
277
+	 * Check whether the key ID parameter is present.
278
+	 *
279
+	 * @return bool
280
+	 */
281
+	public function hasKeyID(): bool
282
+	{
283
+		return $this->has(Parameter\JWTParameter::P_KID);
284
+	}
285
+
286
+	/**
287
+	 * Get the key ID parameter.
288
+	 *
289
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
290
+	 * @throws \LogicException           If the parameter is not present
291
+	 *
292
+	 * @return \Sop\JWX\JWT\Parameter\KeyIDParameter
293
+	 */
294
+	public function keyID(): Parameter\KeyIDParameter
295
+	{
296
+		return self::_checkType($this->get(Parameter\JWTParameter::P_KID),
297
+			Parameter\KeyIDParameter::class);
298
+	}
299
+
300
+	/**
301
+	 * Check whether the PBES2 count parameter is present.
302
+	 *
303
+	 * @return bool
304
+	 */
305
+	public function hasPBES2Count(): bool
306
+	{
307
+		return $this->has(Parameter\JWTParameter::P_P2C);
308
+	}
309
+
310
+	/**
311
+	 * Get the PBES2 count parameter.
312
+	 *
313
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
314
+	 * @throws \LogicException           If the parameter is not present
315
+	 *
316
+	 * @return \Sop\JWX\JWT\Parameter\PBES2CountParameter
317
+	 */
318
+	public function PBES2Count(): Parameter\PBES2CountParameter
319
+	{
320
+		return self::_checkType($this->get(Parameter\JWTParameter::P_P2C),
321
+			Parameter\PBES2CountParameter::class);
322
+	}
323
+
324
+	/**
325
+	 * Check whether the PBES2 salt input parameter is present.
326
+	 *
327
+	 * @return bool
328
+	 */
329
+	public function hasPBES2SaltInput(): bool
330
+	{
331
+		return $this->has(Parameter\JWTParameter::P_P2S);
332
+	}
333
+
334
+	/**
335
+	 * Get the PBES2 salt input parameter.
336
+	 *
337
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
338
+	 * @throws \LogicException           If the parameter is not present
339
+	 *
340
+	 * @return \Sop\JWX\JWT\Parameter\PBES2SaltInputParameter
341
+	 */
342
+	public function PBES2SaltInput(): Parameter\PBES2SaltInputParameter
343
+	{
344
+		return self::_checkType($this->get(Parameter\JWTParameter::P_P2S),
345
+			Parameter\PBES2SaltInputParameter::class);
346
+	}
347
+
348
+	/**
349
+	 * Check whether the type parameter is present.
350
+	 *
351
+	 * @return bool
352
+	 */
353
+	public function hasType(): bool
354
+	{
355
+		return $this->has(Parameter\JWTParameter::P_TYP);
356
+	}
357
+
358
+	/**
359
+	 * Get the type parameter.
360
+	 *
361
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
362
+	 * @throws \LogicException           If the parameter is not present
363
+	 *
364
+	 * @return \Sop\JWX\JWT\Parameter\TypeParameter
365
+	 */
366
+	public function type(): Parameter\TypeParameter
367
+	{
368
+		return self::_checkType($this->get(Parameter\JWTParameter::P_TYP),
369
+			Parameter\TypeParameter::class);
370
+	}
371
+
372
+	/**
373
+	 * Check whether the X.509 certificate chain parameter is present.
374
+	 *
375
+	 * @return bool
376
+	 */
377
+	public function hasX509CertificateChain(): bool
378
+	{
379
+		return $this->has(Parameter\JWTParameter::P_X5C);
380
+	}
381
+
382
+	/**
383
+	 * Get the X.509 certificate chain parameter.
384
+	 *
385
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
386
+	 * @throws \LogicException           If the parameter is not present
387
+	 *
388
+	 * @return \Sop\JWX\JWT\Parameter\X509CertificateChainParameter
389
+	 */
390
+	public function X509CertificateChain(): Parameter\X509CertificateChainParameter
391
+	{
392
+		return self::_checkType($this->get(Parameter\JWTParameter::P_X5C),
393
+			Parameter\X509CertificateChainParameter::class);
394
+	}
395
+
396
+	/**
397
+	 * Check whether the X.509 certificate SHA-1 thumbprint parameter is
398
+	 * present.
399
+	 *
400
+	 * @return bool
401
+	 */
402
+	public function hasX509CertificateSHA1Thumbprint(): bool
403
+	{
404
+		return $this->has(Parameter\JWTParameter::P_X5T);
405
+	}
406
+
407
+	/**
408
+	 * Get the X.509 certificate SHA-1 thumbprint parameter.
409
+	 *
410
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
411
+	 * @throws \LogicException           If the parameter is not present
412
+	 *
413
+	 * @return \Sop\JWX\JWT\Parameter\X509CertificateSHA1ThumbprintParameter
414
+	 */
415
+	public function X509CertificateSHA1Thumbprint(): Parameter\X509CertificateSHA1ThumbprintParameter
416
+	{
417
+		return self::_checkType($this->get(Parameter\JWTParameter::P_X5T),
418
+			Parameter\X509CertificateSHA1ThumbprintParameter::class);
419
+	}
420
+
421
+	/**
422
+	 * Check whether the X.509 certificate SHA-256 thumbprint parameter is
423
+	 * present.
424
+	 *
425
+	 * @return bool
426
+	 */
427
+	public function hasX509CertificateSHA256Thumbprint(): bool
428
+	{
429
+		return $this->has(Parameter\JWTParameter::P_X5TS256);
430
+	}
431
+
432
+	/**
433
+	 * Get the X.509 certificate SHA-256 thumbprint parameter.
434
+	 *
435
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
436
+	 * @throws \LogicException           If the parameter is not present
437
+	 *
438
+	 * @return \Sop\JWX\JWT\Parameter\X509CertificateSHA256ThumbprintParameter
439
+	 */
440
+	public function X509CertificateSHA256Thumbprint(): Parameter\X509CertificateSHA256ThumbprintParameter
441
+	{
442
+		return self::_checkType($this->get(Parameter\JWTParameter::P_X5TS256),
443
+			Parameter\X509CertificateSHA256ThumbprintParameter::class);
444
+	}
445
+
446
+	/**
447
+	 * Check whether the X.509 URL parameter is present.
448
+	 *
449
+	 * @return bool
450
+	 */
451
+	public function hasX509URL(): bool
452
+	{
453
+		return $this->has(Parameter\JWTParameter::P_X5U);
454
+	}
455
+
456
+	/**
457
+	 * Get the X.509 URL parameter.
458
+	 *
459
+	 * @throws \UnexpectedValueException If the parameter has a wrong class
460
+	 * @throws \LogicException           If the parameter is not present
461
+	 *
462
+	 * @return \Sop\JWX\JWT\Parameter\X509URLParameter
463
+	 */
464
+	public function X509URL(): Parameter\X509URLParameter
465
+	{
466
+		return self::_checkType($this->get(Parameter\JWTParameter::P_X5U),
467
+			Parameter\X509URLParameter::class);
468
+	}
469
+
470
+	/**
471
+	 * Check that the parameter is an instance of the given class.
472
+	 *
473
+	 * @param \Sop\JWX\JWT\Parameter\JWTParameter $param Parameter
474
+	 * @param string                              $cls   Class name
475
+	 *
476
+	 * @throws \UnexpectedValueException
477
+	 *
478
+	 * @return \Sop\JWX\JWT\Parameter\JWTParameter
479
+	 */
480
+	private static function _checkType(Parameter\JWTParameter $param, string $cls): Parameter\JWTParameter
481
+	{
482
+		if (!$param instanceof $cls) {
483
+			throw new \UnexpectedValueException(
484
+				"{$cls} expected, got " . get_class($param));
485
+		}
486
+		return $param;
487
+	}
488 488
 }
Please login to merge, or discard this patch.
lib/JWX/Parameter/Feature/Base64URLValue.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -12,54 +12,54 @@
 block discarded – undo
12 12
  */
13 13
 trait Base64URLValue
14 14
 {
15
-    use StringParameterValue;
15
+	use StringParameterValue;
16 16
 
17
-    /**
18
-     * Get the parameter value.
19
-     *
20
-     * @return string
21
-     */
22
-    abstract public function value();
17
+	/**
18
+	 * Get the parameter value.
19
+	 *
20
+	 * @return string
21
+	 */
22
+	abstract public function value();
23 23
 
24
-    /**
25
-     * Initialize from native value.
26
-     *
27
-     * Value shall be encoded using Base64url encoding.
28
-     *
29
-     * @param string $value
30
-     *
31
-     * @return self
32
-     */
33
-    public static function fromString(string $value): Parameter
34
-    {
35
-        return new static(Base64::urlEncode($value));
36
-    }
24
+	/**
25
+	 * Initialize from native value.
26
+	 *
27
+	 * Value shall be encoded using Base64url encoding.
28
+	 *
29
+	 * @param string $value
30
+	 *
31
+	 * @return self
32
+	 */
33
+	public static function fromString(string $value): Parameter
34
+	{
35
+		return new static(Base64::urlEncode($value));
36
+	}
37 37
 
38
-    /**
39
-     * Get the parameter value as a decoded string.
40
-     *
41
-     * @return string
42
-     */
43
-    public function string(): string
44
-    {
45
-        return Base64::urlDecode($this->value());
46
-    }
38
+	/**
39
+	 * Get the parameter value as a decoded string.
40
+	 *
41
+	 * @return string
42
+	 */
43
+	public function string(): string
44
+	{
45
+		return Base64::urlDecode($this->value());
46
+	}
47 47
 
48
-    /**
49
-     * Validate that value is validly base64url encoded.
50
-     *
51
-     * @param string $value
52
-     *
53
-     * @throws \UnexpectedValueException
54
-     *
55
-     * @return self
56
-     */
57
-    protected function _validateEncoding(string $value)
58
-    {
59
-        if (!Base64::isValidURLEncoding($value)) {
60
-            throw new \UnexpectedValueException(
61
-                'Value must be base64url encoded.');
62
-        }
63
-        return $this;
64
-    }
48
+	/**
49
+	 * Validate that value is validly base64url encoded.
50
+	 *
51
+	 * @param string $value
52
+	 *
53
+	 * @throws \UnexpectedValueException
54
+	 *
55
+	 * @return self
56
+	 */
57
+	protected function _validateEncoding(string $value)
58
+	{
59
+		if (!Base64::isValidURLEncoding($value)) {
60
+			throw new \UnexpectedValueException(
61
+				'Value must be base64url encoded.');
62
+		}
63
+		return $this;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
lib/JWX/Parameter/Feature/ArrayParameterValue.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@
 block discarded – undo
11 11
  */
12 12
 trait ArrayParameterValue
13 13
 {
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param mixed ...$values
18
-     */
19
-    abstract public function __construct(...$values);
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param mixed ...$values
18
+	 */
19
+	abstract public function __construct(...$values);
20 20
 
21
-    /**
22
-     * Initialize from a JSON value.
23
-     *
24
-     * @param array $value
25
-     *
26
-     * @return static
27
-     */
28
-    public static function fromJSONValue($value): Parameter
29
-    {
30
-        if (!is_array($value)) {
31
-            throw new \UnexpectedValueException(
32
-                get_called_class() . ' expects an array parameter.');
33
-        }
34
-        return new static(...$value);
35
-    }
21
+	/**
22
+	 * Initialize from a JSON value.
23
+	 *
24
+	 * @param array $value
25
+	 *
26
+	 * @return static
27
+	 */
28
+	public static function fromJSONValue($value): Parameter
29
+	{
30
+		if (!is_array($value)) {
31
+			throw new \UnexpectedValueException(
32
+				get_called_class() . ' expects an array parameter.');
33
+		}
34
+		return new static(...$value);
35
+	}
36 36
 }
Please login to merge, or discard this patch.
lib/JWX/Parameter/Feature/StringParameterValue.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,22 +11,22 @@
 block discarded – undo
11 11
  */
12 12
 trait StringParameterValue
13 13
 {
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param string $value Parameter value
18
-     */
19
-    abstract public function __construct(string $value);
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param string $value Parameter value
18
+	 */
19
+	abstract public function __construct(string $value);
20 20
 
21
-    /**
22
-     * Initialize from a JSON value.
23
-     *
24
-     * @param string $value
25
-     *
26
-     * @return static
27
-     */
28
-    public static function fromJSONValue($value): Parameter
29
-    {
30
-        return new static(strval($value));
31
-    }
21
+	/**
22
+	 * Initialize from a JSON value.
23
+	 *
24
+	 * @param string $value
25
+	 *
26
+	 * @return static
27
+	 */
28
+	public static function fromJSONValue($value): Parameter
29
+	{
30
+		return new static(strval($value));
31
+	}
32 32
 }
Please login to merge, or discard this patch.
lib/JWX/Parameter/Parameter.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -9,37 +9,37 @@
 block discarded – undo
9 9
  */
10 10
 abstract class Parameter
11 11
 {
12
-    /**
13
-     * Parameter name.
14
-     *
15
-     * @var string
16
-     */
17
-    protected $_name;
12
+	/**
13
+	 * Parameter name.
14
+	 *
15
+	 * @var string
16
+	 */
17
+	protected $_name;
18 18
 
19
-    /**
20
-     * Parameter value.
21
-     *
22
-     * @var mixed
23
-     */
24
-    protected $_value;
19
+	/**
20
+	 * Parameter value.
21
+	 *
22
+	 * @var mixed
23
+	 */
24
+	protected $_value;
25 25
 
26
-    /**
27
-     * Get the parameter name.
28
-     *
29
-     * @return string
30
-     */
31
-    public function name(): string
32
-    {
33
-        return $this->_name;
34
-    }
26
+	/**
27
+	 * Get the parameter name.
28
+	 *
29
+	 * @return string
30
+	 */
31
+	public function name(): string
32
+	{
33
+		return $this->_name;
34
+	}
35 35
 
36
-    /**
37
-     * Get the parameter value.
38
-     *
39
-     * @return mixed
40
-     */
41
-    public function value()
42
-    {
43
-        return $this->_value;
44
-    }
36
+	/**
37
+	 * Get the parameter value.
38
+	 *
39
+	 * @return mixed
40
+	 */
41
+	public function value()
42
+	{
43
+		return $this->_value;
44
+	}
45 45
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/Symmetric/SymmetricKeyJWK.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -17,61 +17,61 @@
 block discarded – undo
17 17
  */
18 18
 class SymmetricKeyJWK extends JWK
19 19
 {
20
-    /**
21
-     * Parameter names managed by this class.
22
-     *
23
-     * @internal
24
-     *
25
-     * @var string[]
26
-     */
27
-    const MANAGED_PARAMS = [
28
-        JWKParameter::PARAM_KEY_TYPE,
29
-        JWKParameter::PARAM_KEY_VALUE,
30
-    ];
20
+	/**
21
+	 * Parameter names managed by this class.
22
+	 *
23
+	 * @internal
24
+	 *
25
+	 * @var string[]
26
+	 */
27
+	const MANAGED_PARAMS = [
28
+		JWKParameter::PARAM_KEY_TYPE,
29
+		JWKParameter::PARAM_KEY_VALUE,
30
+	];
31 31
 
32
-    /**
33
-     * Constructor.
34
-     *
35
-     * @param JWKParameter ...$params
36
-     *
37
-     * @throws \UnexpectedValueException If missing required parameter
38
-     */
39
-    public function __construct(JWKParameter ...$params)
40
-    {
41
-        parent::__construct(...$params);
42
-        foreach (self::MANAGED_PARAMS as $name) {
43
-            if (!$this->has($name)) {
44
-                throw new \UnexpectedValueException(
45
-                    "Missing '{$name}' parameter.");
46
-            }
47
-        }
48
-        if (KeyTypeParameter::TYPE_OCT !== $this->keyTypeParameter()->value()) {
49
-            throw new \UnexpectedValueException('Invalid key type.');
50
-        }
51
-    }
32
+	/**
33
+	 * Constructor.
34
+	 *
35
+	 * @param JWKParameter ...$params
36
+	 *
37
+	 * @throws \UnexpectedValueException If missing required parameter
38
+	 */
39
+	public function __construct(JWKParameter ...$params)
40
+	{
41
+		parent::__construct(...$params);
42
+		foreach (self::MANAGED_PARAMS as $name) {
43
+			if (!$this->has($name)) {
44
+				throw new \UnexpectedValueException(
45
+					"Missing '{$name}' parameter.");
46
+			}
47
+		}
48
+		if (KeyTypeParameter::TYPE_OCT !== $this->keyTypeParameter()->value()) {
49
+			throw new \UnexpectedValueException('Invalid key type.');
50
+		}
51
+	}
52 52
 
53
-    /**
54
-     * Initialize from a key string.
55
-     *
56
-     * @param string       $key       Symmetric key
57
-     * @param JWKParameter ...$params Optional additional parameters
58
-     *
59
-     * @return self
60
-     */
61
-    public static function fromKey(string $key, JWKParameter ...$params): self
62
-    {
63
-        $params[] = new KeyTypeParameter(KeyTypeParameter::TYPE_OCT);
64
-        $params[] = KeyValueParameter::fromString($key);
65
-        return new self(...$params);
66
-    }
53
+	/**
54
+	 * Initialize from a key string.
55
+	 *
56
+	 * @param string       $key       Symmetric key
57
+	 * @param JWKParameter ...$params Optional additional parameters
58
+	 *
59
+	 * @return self
60
+	 */
61
+	public static function fromKey(string $key, JWKParameter ...$params): self
62
+	{
63
+		$params[] = new KeyTypeParameter(KeyTypeParameter::TYPE_OCT);
64
+		$params[] = KeyValueParameter::fromString($key);
65
+		return new self(...$params);
66
+	}
67 67
 
68
-    /**
69
-     * Get the symmetric key.
70
-     *
71
-     * @return string
72
-     */
73
-    public function key(): string
74
-    {
75
-        return Base64::urlDecode($this->keyValueParameter()->value());
76
-    }
68
+	/**
69
+	 * Get the symmetric key.
70
+	 *
71
+	 * @return string
72
+	 */
73
+	public function key(): string
74
+	{
75
+		return Base64::urlDecode($this->keyValueParameter()->value());
76
+	}
77 77
 }
Please login to merge, or discard this patch.