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.
Completed
Push — master ( 59f4b4...e271c1 )
by Joni
03:51
created
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.
lib/JWX/JWK/JWKSet.php 1 patch
Indentation   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -13,239 +13,239 @@
 block discarded – undo
13 13
  */
14 14
 class JWKSet implements \Countable, \IteratorAggregate
15 15
 {
16
-    /**
17
-     * JWK objects.
18
-     *
19
-     * @var JWK[]
20
-     */
21
-    protected $_jwks;
22
-
23
-    /**
24
-     * Additional members.
25
-     *
26
-     * @var array
27
-     */
28
-    protected $_additional;
29
-
30
-    /**
31
-     * JWK mappings.
32
-     *
33
-     * @var array
34
-     */
35
-    private $_mappings = [];
36
-
37
-    /**
38
-     * Constructor.
39
-     *
40
-     * @param JWK ...$jwks
41
-     */
42
-    public function __construct(JWK ...$jwks)
43
-    {
44
-        $this->_jwks = $jwks;
45
-        $this->_additional = [];
46
-    }
47
-
48
-    /**
49
-     * Reset internal cache variables on clone.
50
-     */
51
-    public function __clone()
52
-    {
53
-        $this->_mappings = [];
54
-    }
55
-
56
-    /**
57
-     * Initialize from an array representing a JSON object.
58
-     *
59
-     * @param array $members
60
-     *
61
-     * @throws \UnexpectedValueException
62
-     *
63
-     * @return self
64
-     */
65
-    public static function fromArray(array $members): self
66
-    {
67
-        if (!isset($members['keys']) || !is_array($members['keys'])) {
68
-            throw new \UnexpectedValueException(
69
-                "JWK Set must have a 'keys' member.");
70
-        }
71
-        $jwks = array_map(
72
-            function ($jwkdata) {
73
-                return JWK::fromArray($jwkdata);
74
-            }, $members['keys']);
75
-        unset($members['keys']);
76
-        $obj = new self(...$jwks);
77
-        $obj->_additional = $members;
78
-        return $obj;
79
-    }
80
-
81
-    /**
82
-     * Initialize from a JSON string.
83
-     *
84
-     * @param string $json
85
-     *
86
-     * @throws \UnexpectedValueException
87
-     *
88
-     * @return self
89
-     */
90
-    public static function fromJSON(string $json): self
91
-    {
92
-        $members = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
93
-        if (!is_array($members)) {
94
-            throw new \UnexpectedValueException('Invalid JSON.');
95
-        }
96
-        return self::fromArray($members);
97
-    }
98
-
99
-    /**
100
-     * Get self with keys added.
101
-     *
102
-     * @param JWK ...$keys JWK objects
103
-     *
104
-     * @return self
105
-     */
106
-    public function withKeys(JWK ...$keys): self
107
-    {
108
-        $obj = clone $this;
109
-        $obj->_jwks = array_merge($obj->_jwks, $keys);
110
-        return $obj;
111
-    }
112
-
113
-    /**
114
-     * Get all JWK's in a set.
115
-     *
116
-     * @return JWK[]
117
-     */
118
-    public function keys(): array
119
-    {
120
-        return $this->_jwks;
121
-    }
122
-
123
-    /**
124
-     * Get the first JWK in the set.
125
-     *
126
-     * @throws \LogicException
127
-     *
128
-     * @return JWK
129
-     */
130
-    public function first(): JWK
131
-    {
132
-        if (!count($this->_jwks)) {
133
-            throw new \LogicException('No keys.');
134
-        }
135
-        return $this->_jwks[0];
136
-    }
137
-
138
-    /**
139
-     * Check whether set has a JWK with a given key ID.
140
-     *
141
-     * @param string $id
142
-     *
143
-     * @return bool
144
-     */
145
-    public function hasKeyID(string $id): bool
146
-    {
147
-        return null !== $this->_getKeyByID($id);
148
-    }
149
-
150
-    /**
151
-     * Get a JWK by a key ID.
152
-     *
153
-     * @param string $id
154
-     *
155
-     * @throws \LogicException
156
-     *
157
-     * @return JWK
158
-     */
159
-    public function keyByID(string $id): JWK
160
-    {
161
-        $jwk = $this->_getKeyByID($id);
162
-        if (!$jwk) {
163
-            throw new \LogicException("No key ID {$id}.");
164
-        }
165
-        return $jwk;
166
-    }
167
-
168
-    /**
169
-     * Convert to array.
170
-     *
171
-     * @return array
172
-     */
173
-    public function toArray(): array
174
-    {
175
-        $data = $this->_additional;
176
-        $data['keys'] = array_map(
177
-            function (JWK $jwk) {
178
-                return $jwk->toArray();
179
-            }, $this->_jwks);
180
-        return $data;
181
-    }
182
-
183
-    /**
184
-     * Convert to JSON.
185
-     *
186
-     * @return string
187
-     */
188
-    public function toJSON(): string
189
-    {
190
-        return json_encode((object) $this->toArray(), JSON_UNESCAPED_SLASHES);
191
-    }
192
-
193
-    /**
194
-     * Get the number of keys.
195
-     *
196
-     * @see \Countable::count()
197
-     */
198
-    public function count(): int
199
-    {
200
-        return count($this->_jwks);
201
-    }
202
-
203
-    /**
204
-     * Get iterator for JWK objects.
205
-     *
206
-     * @see \IteratorAggregate::getIterator()
207
-     *
208
-     * @return \ArrayIterator
209
-     */
210
-    public function getIterator(): \ArrayIterator
211
-    {
212
-        return new \ArrayIterator($this->_jwks);
213
-    }
214
-
215
-    /**
216
-     * Get JWK by key ID.
217
-     *
218
-     * @param string $id
219
-     *
220
-     * @return null|JWK Null if not found
221
-     */
222
-    protected function _getKeyByID(string $id): ?JWK
223
-    {
224
-        $map = $this->_getMapping(JWKParameter::PARAM_KEY_ID);
225
-        return isset($map[$id]) ? $map[$id] : null;
226
-    }
227
-
228
-    /**
229
-     * Get mapping from parameter values of given parameter name to JWK.
230
-     *
231
-     * Later duplicate value shall override earlier JWK.
232
-     *
233
-     * @param string $name Parameter name
234
-     *
235
-     * @return array
236
-     */
237
-    protected function _getMapping(string $name): array
238
-    {
239
-        if (!isset($this->_mappings[$name])) {
240
-            $mapping = [];
241
-            foreach ($this->_jwks as $jwk) {
242
-                if ($jwk->has($name)) {
243
-                    $key = (string) $jwk->get($name)->value();
244
-                    $mapping[$key] = $jwk;
245
-                }
246
-            }
247
-            $this->_mappings[$name] = $mapping;
248
-        }
249
-        return $this->_mappings[$name];
250
-    }
16
+	/**
17
+	 * JWK objects.
18
+	 *
19
+	 * @var JWK[]
20
+	 */
21
+	protected $_jwks;
22
+
23
+	/**
24
+	 * Additional members.
25
+	 *
26
+	 * @var array
27
+	 */
28
+	protected $_additional;
29
+
30
+	/**
31
+	 * JWK mappings.
32
+	 *
33
+	 * @var array
34
+	 */
35
+	private $_mappings = [];
36
+
37
+	/**
38
+	 * Constructor.
39
+	 *
40
+	 * @param JWK ...$jwks
41
+	 */
42
+	public function __construct(JWK ...$jwks)
43
+	{
44
+		$this->_jwks = $jwks;
45
+		$this->_additional = [];
46
+	}
47
+
48
+	/**
49
+	 * Reset internal cache variables on clone.
50
+	 */
51
+	public function __clone()
52
+	{
53
+		$this->_mappings = [];
54
+	}
55
+
56
+	/**
57
+	 * Initialize from an array representing a JSON object.
58
+	 *
59
+	 * @param array $members
60
+	 *
61
+	 * @throws \UnexpectedValueException
62
+	 *
63
+	 * @return self
64
+	 */
65
+	public static function fromArray(array $members): self
66
+	{
67
+		if (!isset($members['keys']) || !is_array($members['keys'])) {
68
+			throw new \UnexpectedValueException(
69
+				"JWK Set must have a 'keys' member.");
70
+		}
71
+		$jwks = array_map(
72
+			function ($jwkdata) {
73
+				return JWK::fromArray($jwkdata);
74
+			}, $members['keys']);
75
+		unset($members['keys']);
76
+		$obj = new self(...$jwks);
77
+		$obj->_additional = $members;
78
+		return $obj;
79
+	}
80
+
81
+	/**
82
+	 * Initialize from a JSON string.
83
+	 *
84
+	 * @param string $json
85
+	 *
86
+	 * @throws \UnexpectedValueException
87
+	 *
88
+	 * @return self
89
+	 */
90
+	public static function fromJSON(string $json): self
91
+	{
92
+		$members = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
93
+		if (!is_array($members)) {
94
+			throw new \UnexpectedValueException('Invalid JSON.');
95
+		}
96
+		return self::fromArray($members);
97
+	}
98
+
99
+	/**
100
+	 * Get self with keys added.
101
+	 *
102
+	 * @param JWK ...$keys JWK objects
103
+	 *
104
+	 * @return self
105
+	 */
106
+	public function withKeys(JWK ...$keys): self
107
+	{
108
+		$obj = clone $this;
109
+		$obj->_jwks = array_merge($obj->_jwks, $keys);
110
+		return $obj;
111
+	}
112
+
113
+	/**
114
+	 * Get all JWK's in a set.
115
+	 *
116
+	 * @return JWK[]
117
+	 */
118
+	public function keys(): array
119
+	{
120
+		return $this->_jwks;
121
+	}
122
+
123
+	/**
124
+	 * Get the first JWK in the set.
125
+	 *
126
+	 * @throws \LogicException
127
+	 *
128
+	 * @return JWK
129
+	 */
130
+	public function first(): JWK
131
+	{
132
+		if (!count($this->_jwks)) {
133
+			throw new \LogicException('No keys.');
134
+		}
135
+		return $this->_jwks[0];
136
+	}
137
+
138
+	/**
139
+	 * Check whether set has a JWK with a given key ID.
140
+	 *
141
+	 * @param string $id
142
+	 *
143
+	 * @return bool
144
+	 */
145
+	public function hasKeyID(string $id): bool
146
+	{
147
+		return null !== $this->_getKeyByID($id);
148
+	}
149
+
150
+	/**
151
+	 * Get a JWK by a key ID.
152
+	 *
153
+	 * @param string $id
154
+	 *
155
+	 * @throws \LogicException
156
+	 *
157
+	 * @return JWK
158
+	 */
159
+	public function keyByID(string $id): JWK
160
+	{
161
+		$jwk = $this->_getKeyByID($id);
162
+		if (!$jwk) {
163
+			throw new \LogicException("No key ID {$id}.");
164
+		}
165
+		return $jwk;
166
+	}
167
+
168
+	/**
169
+	 * Convert to array.
170
+	 *
171
+	 * @return array
172
+	 */
173
+	public function toArray(): array
174
+	{
175
+		$data = $this->_additional;
176
+		$data['keys'] = array_map(
177
+			function (JWK $jwk) {
178
+				return $jwk->toArray();
179
+			}, $this->_jwks);
180
+		return $data;
181
+	}
182
+
183
+	/**
184
+	 * Convert to JSON.
185
+	 *
186
+	 * @return string
187
+	 */
188
+	public function toJSON(): string
189
+	{
190
+		return json_encode((object) $this->toArray(), JSON_UNESCAPED_SLASHES);
191
+	}
192
+
193
+	/**
194
+	 * Get the number of keys.
195
+	 *
196
+	 * @see \Countable::count()
197
+	 */
198
+	public function count(): int
199
+	{
200
+		return count($this->_jwks);
201
+	}
202
+
203
+	/**
204
+	 * Get iterator for JWK objects.
205
+	 *
206
+	 * @see \IteratorAggregate::getIterator()
207
+	 *
208
+	 * @return \ArrayIterator
209
+	 */
210
+	public function getIterator(): \ArrayIterator
211
+	{
212
+		return new \ArrayIterator($this->_jwks);
213
+	}
214
+
215
+	/**
216
+	 * Get JWK by key ID.
217
+	 *
218
+	 * @param string $id
219
+	 *
220
+	 * @return null|JWK Null if not found
221
+	 */
222
+	protected function _getKeyByID(string $id): ?JWK
223
+	{
224
+		$map = $this->_getMapping(JWKParameter::PARAM_KEY_ID);
225
+		return isset($map[$id]) ? $map[$id] : null;
226
+	}
227
+
228
+	/**
229
+	 * Get mapping from parameter values of given parameter name to JWK.
230
+	 *
231
+	 * Later duplicate value shall override earlier JWK.
232
+	 *
233
+	 * @param string $name Parameter name
234
+	 *
235
+	 * @return array
236
+	 */
237
+	protected function _getMapping(string $name): array
238
+	{
239
+		if (!isset($this->_mappings[$name])) {
240
+			$mapping = [];
241
+			foreach ($this->_jwks as $jwk) {
242
+				if ($jwk->has($name)) {
243
+					$key = (string) $jwk->get($name)->value();
244
+					$mapping[$key] = $jwk;
245
+				}
246
+			}
247
+			$this->_mappings[$name] = $mapping;
248
+		}
249
+		return $this->_mappings[$name];
250
+	}
251 251
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/RSA/RSAPublicKeyJWK.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -22,77 +22,77 @@
 block discarded – undo
22 22
  */
23 23
 class RSAPublicKeyJWK extends PublicKeyJWK
24 24
 {
25
-    /**
26
-     * Parameter names managed by this class.
27
-     *
28
-     * @internal
29
-     *
30
-     * @var string[]
31
-     */
32
-    const MANAGED_PARAMS = [
33
-        JWKParameter::PARAM_KEY_TYPE,
34
-        JWKParameter::PARAM_MODULUS,
35
-        JWKParameter::PARAM_EXPONENT,
36
-    ];
25
+	/**
26
+	 * Parameter names managed by this class.
27
+	 *
28
+	 * @internal
29
+	 *
30
+	 * @var string[]
31
+	 */
32
+	const MANAGED_PARAMS = [
33
+		JWKParameter::PARAM_KEY_TYPE,
34
+		JWKParameter::PARAM_MODULUS,
35
+		JWKParameter::PARAM_EXPONENT,
36
+	];
37 37
 
38
-    /**
39
-     * Constructor.
40
-     *
41
-     * @param JWKParameter ...$params
42
-     *
43
-     * @throws \UnexpectedValueException If missing required parameter
44
-     */
45
-    public function __construct(JWKParameter ...$params)
46
-    {
47
-        parent::__construct(...$params);
48
-        foreach (self::MANAGED_PARAMS as $name) {
49
-            if (!$this->has($name)) {
50
-                throw new \UnexpectedValueException(
51
-                    "Missing '{$name}' parameter.");
52
-            }
53
-        }
54
-        if (KeyTypeParameter::TYPE_RSA !== $this->keyTypeParameter()->value()) {
55
-            throw new \UnexpectedValueException('Invalid key type.');
56
-        }
57
-    }
38
+	/**
39
+	 * Constructor.
40
+	 *
41
+	 * @param JWKParameter ...$params
42
+	 *
43
+	 * @throws \UnexpectedValueException If missing required parameter
44
+	 */
45
+	public function __construct(JWKParameter ...$params)
46
+	{
47
+		parent::__construct(...$params);
48
+		foreach (self::MANAGED_PARAMS as $name) {
49
+			if (!$this->has($name)) {
50
+				throw new \UnexpectedValueException(
51
+					"Missing '{$name}' parameter.");
52
+			}
53
+		}
54
+		if (KeyTypeParameter::TYPE_RSA !== $this->keyTypeParameter()->value()) {
55
+			throw new \UnexpectedValueException('Invalid key type.');
56
+		}
57
+	}
58 58
 
59
-    /**
60
-     * Initialize from RSAPublicKey.
61
-     *
62
-     * @param RSAPublicKey $pk
63
-     *
64
-     * @return self
65
-     */
66
-    public static function fromRSAPublicKey(RSAPublicKey $pk): self
67
-    {
68
-        $n = ModulusParameter::fromNumber($pk->modulus());
69
-        $e = ExponentParameter::fromNumber($pk->publicExponent());
70
-        $key_type = new KeyTypeParameter(KeyTypeParameter::TYPE_RSA);
71
-        return new self($key_type, $n, $e);
72
-    }
59
+	/**
60
+	 * Initialize from RSAPublicKey.
61
+	 *
62
+	 * @param RSAPublicKey $pk
63
+	 *
64
+	 * @return self
65
+	 */
66
+	public static function fromRSAPublicKey(RSAPublicKey $pk): self
67
+	{
68
+		$n = ModulusParameter::fromNumber($pk->modulus());
69
+		$e = ExponentParameter::fromNumber($pk->publicExponent());
70
+		$key_type = new KeyTypeParameter(KeyTypeParameter::TYPE_RSA);
71
+		return new self($key_type, $n, $e);
72
+	}
73 73
 
74
-    /**
75
-     * Initialize from PEM.
76
-     *
77
-     * @param PEM $pem
78
-     *
79
-     * @return self
80
-     */
81
-    public static function fromPEM(PEM $pem): self
82
-    {
83
-        return self::fromRSAPublicKey(RSAPublicKey::fromPEM($pem));
84
-    }
74
+	/**
75
+	 * Initialize from PEM.
76
+	 *
77
+	 * @param PEM $pem
78
+	 *
79
+	 * @return self
80
+	 */
81
+	public static function fromPEM(PEM $pem): self
82
+	{
83
+		return self::fromRSAPublicKey(RSAPublicKey::fromPEM($pem));
84
+	}
85 85
 
86
-    /**
87
-     * Convert JWK to PEM.
88
-     *
89
-     * @return PEM
90
-     */
91
-    public function toPEM(): PEM
92
-    {
93
-        $n = $this->modulusParameter()->number()->base10();
94
-        $e = $this->exponentParameter()->number()->base10();
95
-        $pk = new RSAPublicKey($n, $e);
96
-        return PublicKeyInfo::fromPublicKey($pk)->toPEM();
97
-    }
86
+	/**
87
+	 * Convert JWK to PEM.
88
+	 *
89
+	 * @return PEM
90
+	 */
91
+	public function toPEM(): PEM
92
+	{
93
+		$n = $this->modulusParameter()->number()->base10();
94
+		$e = $this->exponentParameter()->number()->base10();
95
+		$pk = new RSAPublicKey($n, $e);
96
+		return PublicKeyInfo::fromPublicKey($pk)->toPEM();
97
+	}
98 98
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/RSA/RSAPrivateKeyJWK.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -29,112 +29,112 @@
 block discarded – undo
29 29
  */
30 30
 class RSAPrivateKeyJWK extends PrivateKeyJWK
31 31
 {
32
-    /**
33
-     * Parameter names managed by this class.
34
-     *
35
-     * @internal
36
-     *
37
-     * @var string[]
38
-     */
39
-    const MANAGED_PARAMS = [
40
-        JWKParameter::PARAM_KEY_TYPE,
41
-        JWKParameter::PARAM_MODULUS,
42
-        JWKParameter::PARAM_EXPONENT,
43
-        JWKParameter::PARAM_PRIVATE_EXPONENT,
44
-        JWKParameter::PARAM_FIRST_PRIME_FACTOR,
45
-        JWKParameter::PARAM_SECOND_PRIME_FACTOR,
46
-        JWKParameter::PARAM_FIRST_FACTOR_CRT_EXPONENT,
47
-        JWKParameter::PARAM_SECOND_FACTOR_CRT_EXPONENT,
48
-        JWKParameter::PARAM_FIRST_CRT_COEFFICIENT,
49
-    ];
32
+	/**
33
+	 * Parameter names managed by this class.
34
+	 *
35
+	 * @internal
36
+	 *
37
+	 * @var string[]
38
+	 */
39
+	const MANAGED_PARAMS = [
40
+		JWKParameter::PARAM_KEY_TYPE,
41
+		JWKParameter::PARAM_MODULUS,
42
+		JWKParameter::PARAM_EXPONENT,
43
+		JWKParameter::PARAM_PRIVATE_EXPONENT,
44
+		JWKParameter::PARAM_FIRST_PRIME_FACTOR,
45
+		JWKParameter::PARAM_SECOND_PRIME_FACTOR,
46
+		JWKParameter::PARAM_FIRST_FACTOR_CRT_EXPONENT,
47
+		JWKParameter::PARAM_SECOND_FACTOR_CRT_EXPONENT,
48
+		JWKParameter::PARAM_FIRST_CRT_COEFFICIENT,
49
+	];
50 50
 
51
-    /**
52
-     * Constructor.
53
-     *
54
-     * @param JWKParameter ...$params
55
-     *
56
-     * @throws \UnexpectedValueException If missing required parameter
57
-     */
58
-    public function __construct(JWKParameter ...$params)
59
-    {
60
-        parent::__construct(...$params);
61
-        foreach (self::MANAGED_PARAMS as $name) {
62
-            if (!$this->has($name)) {
63
-                throw new \UnexpectedValueException(
64
-                    "Missing '{$name}' parameter.");
65
-            }
66
-        }
67
-        if (KeyTypeParameter::TYPE_RSA !== $this->keyTypeParameter()->value()) {
68
-            throw new \UnexpectedValueException('Invalid key type.');
69
-        }
70
-        // cast private exponent to correct class
71
-        $key = JWKParameter::PARAM_PRIVATE_EXPONENT;
72
-        $this->_parameters[$key] = new PrivateExponentParameter(
73
-            $this->_parameters[$key]->value());
74
-    }
51
+	/**
52
+	 * Constructor.
53
+	 *
54
+	 * @param JWKParameter ...$params
55
+	 *
56
+	 * @throws \UnexpectedValueException If missing required parameter
57
+	 */
58
+	public function __construct(JWKParameter ...$params)
59
+	{
60
+		parent::__construct(...$params);
61
+		foreach (self::MANAGED_PARAMS as $name) {
62
+			if (!$this->has($name)) {
63
+				throw new \UnexpectedValueException(
64
+					"Missing '{$name}' parameter.");
65
+			}
66
+		}
67
+		if (KeyTypeParameter::TYPE_RSA !== $this->keyTypeParameter()->value()) {
68
+			throw new \UnexpectedValueException('Invalid key type.');
69
+		}
70
+		// cast private exponent to correct class
71
+		$key = JWKParameter::PARAM_PRIVATE_EXPONENT;
72
+		$this->_parameters[$key] = new PrivateExponentParameter(
73
+			$this->_parameters[$key]->value());
74
+	}
75 75
 
76
-    /**
77
-     * Initialize from RSAPrivateKey.
78
-     *
79
-     * @param RSAPrivateKey $pk
80
-     *
81
-     * @return self
82
-     */
83
-    public static function fromRSAPrivateKey(RSAPrivateKey $pk): self
84
-    {
85
-        $n = ModulusParameter::fromNumber($pk->modulus());
86
-        $e = ExponentParameter::fromNumber($pk->publicExponent());
87
-        $d = PrivateExponentParameter::fromNumber($pk->privateExponent());
88
-        $p = FirstPrimeFactorParameter::fromNumber($pk->prime1());
89
-        $q = SecondPrimeFactorParameter::fromNumber($pk->prime2());
90
-        $dp = FirstFactorCRTExponentParameter::fromNumber($pk->exponent1());
91
-        $dq = SecondFactorCRTExponentParameter::fromNumber($pk->exponent2());
92
-        $qi = FirstCRTCoefficientParameter::fromNumber($pk->coefficient());
93
-        $key_type = new KeyTypeParameter(KeyTypeParameter::TYPE_RSA);
94
-        return new self($key_type, $n, $e, $d, $p, $q, $dp, $dq, $qi);
95
-    }
76
+	/**
77
+	 * Initialize from RSAPrivateKey.
78
+	 *
79
+	 * @param RSAPrivateKey $pk
80
+	 *
81
+	 * @return self
82
+	 */
83
+	public static function fromRSAPrivateKey(RSAPrivateKey $pk): self
84
+	{
85
+		$n = ModulusParameter::fromNumber($pk->modulus());
86
+		$e = ExponentParameter::fromNumber($pk->publicExponent());
87
+		$d = PrivateExponentParameter::fromNumber($pk->privateExponent());
88
+		$p = FirstPrimeFactorParameter::fromNumber($pk->prime1());
89
+		$q = SecondPrimeFactorParameter::fromNumber($pk->prime2());
90
+		$dp = FirstFactorCRTExponentParameter::fromNumber($pk->exponent1());
91
+		$dq = SecondFactorCRTExponentParameter::fromNumber($pk->exponent2());
92
+		$qi = FirstCRTCoefficientParameter::fromNumber($pk->coefficient());
93
+		$key_type = new KeyTypeParameter(KeyTypeParameter::TYPE_RSA);
94
+		return new self($key_type, $n, $e, $d, $p, $q, $dp, $dq, $qi);
95
+	}
96 96
 
97
-    /**
98
-     * Initialize from PEM.
99
-     *
100
-     * @param PEM $pem
101
-     *
102
-     * @return self
103
-     */
104
-    public static function fromPEM(PEM $pem): self
105
-    {
106
-        return self::fromRSAPrivateKey(RSAPrivateKey::fromPEM($pem));
107
-    }
97
+	/**
98
+	 * Initialize from PEM.
99
+	 *
100
+	 * @param PEM $pem
101
+	 *
102
+	 * @return self
103
+	 */
104
+	public static function fromPEM(PEM $pem): self
105
+	{
106
+		return self::fromRSAPrivateKey(RSAPrivateKey::fromPEM($pem));
107
+	}
108 108
 
109
-    /**
110
-     * Get public key component.
111
-     *
112
-     * @return RSAPublicKeyJWK
113
-     */
114
-    public function publicKey(): PublicKeyJWK
115
-    {
116
-        $kty = $this->keyTypeParameter();
117
-        $n = $this->modulusParameter();
118
-        $e = $this->exponentParameter();
119
-        return new RSAPublicKeyJWK($kty, $n, $e);
120
-    }
109
+	/**
110
+	 * Get public key component.
111
+	 *
112
+	 * @return RSAPublicKeyJWK
113
+	 */
114
+	public function publicKey(): PublicKeyJWK
115
+	{
116
+		$kty = $this->keyTypeParameter();
117
+		$n = $this->modulusParameter();
118
+		$e = $this->exponentParameter();
119
+		return new RSAPublicKeyJWK($kty, $n, $e);
120
+	}
121 121
 
122
-    /**
123
-     * Convert JWK to PEM.
124
-     *
125
-     * @return PEM
126
-     */
127
-    public function toPEM(): PEM
128
-    {
129
-        $n = $this->modulusParameter()->number()->base10();
130
-        $e = $this->exponentParameter()->number()->base10();
131
-        $d = $this->privateExponentParameter()->number()->base10();
132
-        $p = $this->firstPrimeFactorParameter()->number()->base10();
133
-        $q = $this->secondPrimeFactorParameter()->number()->base10();
134
-        $dp = $this->firstFactorCRTExponentParameter()->number()->base10();
135
-        $dq = $this->secondFactorCRTExponentParameter()->number()->base10();
136
-        $qi = $this->firstCRTCoefficientParameter()->number()->base10();
137
-        $pk = new RSAPrivateKey($n, $e, $d, $p, $q, $dp, $dq, $qi);
138
-        return PrivateKeyInfo::fromPrivateKey($pk)->toPEM();
139
-    }
122
+	/**
123
+	 * Convert JWK to PEM.
124
+	 *
125
+	 * @return PEM
126
+	 */
127
+	public function toPEM(): PEM
128
+	{
129
+		$n = $this->modulusParameter()->number()->base10();
130
+		$e = $this->exponentParameter()->number()->base10();
131
+		$d = $this->privateExponentParameter()->number()->base10();
132
+		$p = $this->firstPrimeFactorParameter()->number()->base10();
133
+		$q = $this->secondPrimeFactorParameter()->number()->base10();
134
+		$dp = $this->firstFactorCRTExponentParameter()->number()->base10();
135
+		$dq = $this->secondFactorCRTExponentParameter()->number()->base10();
136
+		$qi = $this->firstCRTCoefficientParameter()->number()->base10();
137
+		$pk = new RSAPrivateKey($n, $e, $d, $p, $q, $dp, $dq, $qi);
138
+		return PrivateKeyInfo::fromPrivateKey($pk)->toPEM();
139
+	}
140 140
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/Parameter/X509CertificateChainParameter.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
  */
15 15
 class X509CertificateChainParameter extends JWKParameter
16 16
 {
17
-    use ArrayParameterValue;
17
+	use ArrayParameterValue;
18 18
 
19
-    /**
20
-     * Constructor.
21
-     *
22
-     * @param string ...$certs Base64 encoded DER certificates
23
-     */
24
-    public function __construct(string ...$certs)
25
-    {
26
-        foreach ($certs as $cert) {
27
-            if (!Base64::isValid($cert)) {
28
-                throw new \UnexpectedValueException(
29
-                    'Certificate must be base64 encoded.');
30
-            }
31
-        }
32
-        parent::__construct(self::PARAM_X509_CERTIFICATE_CHAIN, $certs);
33
-    }
19
+	/**
20
+	 * Constructor.
21
+	 *
22
+	 * @param string ...$certs Base64 encoded DER certificates
23
+	 */
24
+	public function __construct(string ...$certs)
25
+	{
26
+		foreach ($certs as $cert) {
27
+			if (!Base64::isValid($cert)) {
28
+				throw new \UnexpectedValueException(
29
+					'Certificate must be base64 encoded.');
30
+			}
31
+		}
32
+		parent::__construct(self::PARAM_X509_CERTIFICATE_CHAIN, $certs);
33
+	}
34 34
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/Parameter/KeyOperationsParameter.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,24 +13,24 @@
 block discarded – undo
13 13
  */
14 14
 class KeyOperationsParameter extends JWKParameter
15 15
 {
16
-    use ArrayParameterValue;
16
+	use ArrayParameterValue;
17 17
 
18
-    const OP_SIGN = 'sign';
19
-    const OP_VERIFY = 'verify';
20
-    const OP_ENCRYPT = 'encrypt';
21
-    const OP_DECRYPT = 'decrypt';
22
-    const OP_WRAP_KEY = 'wrapKey';
23
-    const OP_UNWRAP_KEY = 'unwrapKey';
24
-    const OP_DERIVE_KEY = 'deriveKey';
25
-    const OP_DERIVE_BITS = 'deriveBits';
18
+	const OP_SIGN = 'sign';
19
+	const OP_VERIFY = 'verify';
20
+	const OP_ENCRYPT = 'encrypt';
21
+	const OP_DECRYPT = 'decrypt';
22
+	const OP_WRAP_KEY = 'wrapKey';
23
+	const OP_UNWRAP_KEY = 'unwrapKey';
24
+	const OP_DERIVE_KEY = 'deriveKey';
25
+	const OP_DERIVE_BITS = 'deriveBits';
26 26
 
27
-    /**
28
-     * Constructor.
29
-     *
30
-     * @param string ...$ops Key operations
31
-     */
32
-    public function __construct(string ...$ops)
33
-    {
34
-        parent::__construct(self::PARAM_KEY_OPERATIONS, $ops);
35
-    }
27
+	/**
28
+	 * Constructor.
29
+	 *
30
+	 * @param string ...$ops Key operations
31
+	 */
32
+	public function __construct(string ...$ops)
33
+	{
34
+		parent::__construct(self::PARAM_KEY_OPERATIONS, $ops);
35
+	}
36 36
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/Parameter/PublicKeyUseParameter.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@
 block discarded – undo
13 13
  */
14 14
 class PublicKeyUseParameter extends JWKParameter
15 15
 {
16
-    use StringParameterValue;
16
+	use StringParameterValue;
17 17
 
18
-    const USE_SIGNATURE = 'sig';
19
-    const USE_ENCRYPTION = 'enc';
18
+	const USE_SIGNATURE = 'sig';
19
+	const USE_ENCRYPTION = 'enc';
20 20
 
21
-    /**
22
-     * Constructor.
23
-     *
24
-     * @param string $use Intended use of the public key
25
-     */
26
-    public function __construct(string $use)
27
-    {
28
-        parent::__construct(self::PARAM_PUBLIC_KEY_USE, $use);
29
-    }
21
+	/**
22
+	 * Constructor.
23
+	 *
24
+	 * @param string $use Intended use of the public key
25
+	 */
26
+	public function __construct(string $use)
27
+	{
28
+		parent::__construct(self::PARAM_PUBLIC_KEY_USE, $use);
29
+	}
30 30
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/Parameter/KeyTypeParameter.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@
 block discarded – undo
13 13
  */
14 14
 class KeyTypeParameter extends JWKParameter
15 15
 {
16
-    use StringParameterValue;
17
-
18
-    /**
19
-     * Octet sequence key type.
20
-     */
21
-    const TYPE_OCT = 'oct';
22
-
23
-    /**
24
-     * RSA key type.
25
-     */
26
-    const TYPE_RSA = 'RSA';
27
-
28
-    /**
29
-     * Elliptic curve key type.
30
-     */
31
-    const TYPE_EC = 'EC';
32
-
33
-    /**
34
-     * Constructor.
35
-     *
36
-     * @param string $type Key type
37
-     */
38
-    public function __construct(string $type)
39
-    {
40
-        parent::__construct(self::PARAM_KEY_TYPE, $type);
41
-    }
16
+	use StringParameterValue;
17
+
18
+	/**
19
+	 * Octet sequence key type.
20
+	 */
21
+	const TYPE_OCT = 'oct';
22
+
23
+	/**
24
+	 * RSA key type.
25
+	 */
26
+	const TYPE_RSA = 'RSA';
27
+
28
+	/**
29
+	 * Elliptic curve key type.
30
+	 */
31
+	const TYPE_EC = 'EC';
32
+
33
+	/**
34
+	 * Constructor.
35
+	 *
36
+	 * @param string $type Key type
37
+	 */
38
+	public function __construct(string $type)
39
+	{
40
+		parent::__construct(self::PARAM_KEY_TYPE, $type);
41
+	}
42 42
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/Parameter/JWKParameter.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -14,131 +14,131 @@
 block discarded – undo
14 14
  */
15 15
 class JWKParameter extends Parameter
16 16
 {
17
-    // registered parameter names
18
-    const PARAM_KEY_TYPE = 'kty';
19
-    const PARAM_PUBLIC_KEY_USE = 'use';
20
-    const PARAM_KEY_OPERATIONS = 'key_ops';
21
-    const PARAM_ALGORITHM = 'alg';
22
-    const PARAM_KEY_ID = 'kid';
23
-    const PARAM_X509_URL = 'x5u';
24
-    const PARAM_X509_CERTIFICATE_CHAIN = 'x5c';
25
-    const PARAM_X509_CERTIFICATE_SHA1_THUMBPRINT = 'x5t';
26
-    const PARAM_X509_CERTIFICATE_SHA256_THUMBPRINT = 'x5t#S256';
27
-    const PARAM_CURVE = 'crv';
28
-    const PARAM_X_COORDINATE = 'x';
29
-    const PARAM_Y_COORDINATE = 'y';
30
-    const PARAM_ECC_PRIVATE_KEY = 'd';
31
-    const PARAM_MODULUS = 'n';
32
-    const PARAM_EXPONENT = 'e';
33
-    const PARAM_PRIVATE_EXPONENT = 'd';
34
-    const PARAM_FIRST_PRIME_FACTOR = 'p';
35
-    const PARAM_SECOND_PRIME_FACTOR = 'q';
36
-    const PARAM_FIRST_FACTOR_CRT_EXPONENT = 'dp';
37
-    const PARAM_SECOND_FACTOR_CRT_EXPONENT = 'dq';
38
-    const PARAM_FIRST_CRT_COEFFICIENT = 'qi';
39
-    const PARAM_OTHER_PRIMES_INFO = 'oth';
40
-    const PARAM_KEY_VALUE = 'k';
17
+	// registered parameter names
18
+	const PARAM_KEY_TYPE = 'kty';
19
+	const PARAM_PUBLIC_KEY_USE = 'use';
20
+	const PARAM_KEY_OPERATIONS = 'key_ops';
21
+	const PARAM_ALGORITHM = 'alg';
22
+	const PARAM_KEY_ID = 'kid';
23
+	const PARAM_X509_URL = 'x5u';
24
+	const PARAM_X509_CERTIFICATE_CHAIN = 'x5c';
25
+	const PARAM_X509_CERTIFICATE_SHA1_THUMBPRINT = 'x5t';
26
+	const PARAM_X509_CERTIFICATE_SHA256_THUMBPRINT = 'x5t#S256';
27
+	const PARAM_CURVE = 'crv';
28
+	const PARAM_X_COORDINATE = 'x';
29
+	const PARAM_Y_COORDINATE = 'y';
30
+	const PARAM_ECC_PRIVATE_KEY = 'd';
31
+	const PARAM_MODULUS = 'n';
32
+	const PARAM_EXPONENT = 'e';
33
+	const PARAM_PRIVATE_EXPONENT = 'd';
34
+	const PARAM_FIRST_PRIME_FACTOR = 'p';
35
+	const PARAM_SECOND_PRIME_FACTOR = 'q';
36
+	const PARAM_FIRST_FACTOR_CRT_EXPONENT = 'dp';
37
+	const PARAM_SECOND_FACTOR_CRT_EXPONENT = 'dq';
38
+	const PARAM_FIRST_CRT_COEFFICIENT = 'qi';
39
+	const PARAM_OTHER_PRIMES_INFO = 'oth';
40
+	const PARAM_KEY_VALUE = 'k';
41 41
 
42
-    // shorthand aliases for parameter names
43
-    const P_KTY = self::PARAM_KEY_TYPE;
44
-    const P_USE = self::PARAM_PUBLIC_KEY_USE;
45
-    const P_KEY_OPS = self::PARAM_KEY_OPERATIONS;
46
-    const P_ALG = self::PARAM_ALGORITHM;
47
-    const P_KID = self::PARAM_KEY_ID;
48
-    const P_X5U = self::PARAM_X509_URL;
49
-    const P_X5C = self::PARAM_X509_CERTIFICATE_CHAIN;
50
-    const P_X5T = self::PARAM_X509_CERTIFICATE_SHA1_THUMBPRINT;
51
-    const P_X5TS256 = self::PARAM_X509_CERTIFICATE_SHA256_THUMBPRINT;
52
-    const P_CRV = self::PARAM_CURVE;
53
-    const P_X = self::PARAM_X_COORDINATE;
54
-    const P_Y = self::PARAM_Y_COORDINATE;
55
-    const P_ECC_D = self::PARAM_ECC_PRIVATE_KEY;
56
-    const P_N = self::PARAM_MODULUS;
57
-    const P_E = self::PARAM_EXPONENT;
58
-    const P_RSA_D = self::PARAM_PRIVATE_EXPONENT;
59
-    const P_P = self::PARAM_FIRST_PRIME_FACTOR;
60
-    const P_Q = self::PARAM_SECOND_PRIME_FACTOR;
61
-    const P_DP = self::PARAM_FIRST_FACTOR_CRT_EXPONENT;
62
-    const P_DQ = self::PARAM_SECOND_FACTOR_CRT_EXPONENT;
63
-    const P_QI = self::PARAM_FIRST_CRT_COEFFICIENT;
64
-    const P_OTH = self::PARAM_OTHER_PRIMES_INFO;
65
-    const P_K = self::PARAM_KEY_VALUE;
42
+	// shorthand aliases for parameter names
43
+	const P_KTY = self::PARAM_KEY_TYPE;
44
+	const P_USE = self::PARAM_PUBLIC_KEY_USE;
45
+	const P_KEY_OPS = self::PARAM_KEY_OPERATIONS;
46
+	const P_ALG = self::PARAM_ALGORITHM;
47
+	const P_KID = self::PARAM_KEY_ID;
48
+	const P_X5U = self::PARAM_X509_URL;
49
+	const P_X5C = self::PARAM_X509_CERTIFICATE_CHAIN;
50
+	const P_X5T = self::PARAM_X509_CERTIFICATE_SHA1_THUMBPRINT;
51
+	const P_X5TS256 = self::PARAM_X509_CERTIFICATE_SHA256_THUMBPRINT;
52
+	const P_CRV = self::PARAM_CURVE;
53
+	const P_X = self::PARAM_X_COORDINATE;
54
+	const P_Y = self::PARAM_Y_COORDINATE;
55
+	const P_ECC_D = self::PARAM_ECC_PRIVATE_KEY;
56
+	const P_N = self::PARAM_MODULUS;
57
+	const P_E = self::PARAM_EXPONENT;
58
+	const P_RSA_D = self::PARAM_PRIVATE_EXPONENT;
59
+	const P_P = self::PARAM_FIRST_PRIME_FACTOR;
60
+	const P_Q = self::PARAM_SECOND_PRIME_FACTOR;
61
+	const P_DP = self::PARAM_FIRST_FACTOR_CRT_EXPONENT;
62
+	const P_DQ = self::PARAM_SECOND_FACTOR_CRT_EXPONENT;
63
+	const P_QI = self::PARAM_FIRST_CRT_COEFFICIENT;
64
+	const P_OTH = self::PARAM_OTHER_PRIMES_INFO;
65
+	const P_K = self::PARAM_KEY_VALUE;
66 66
 
67
-    /**
68
-     * Mapping from registered JWK parameter name to class name.
69
-     *
70
-     * Note that ECC private key and RSA private key cannot be mapped since
71
-     * they share the same parameter name 'd'.
72
-     *
73
-     * @internal
74
-     *
75
-     * @var array
76
-     */
77
-    const MAP_NAME_TO_CLASS = [
78
-        self::P_KTY => KeyTypeParameter::class,
79
-        self::P_USE => PublicKeyUseParameter::class,
80
-        self::P_KEY_OPS => KeyOperationsParameter::class,
81
-        self::P_ALG => AlgorithmParameter::class,
82
-        self::P_KID => KeyIDParameter::class,
83
-        self::P_X5U => X509URLParameter::class,
84
-        self::P_X5C => X509CertificateChainParameter::class,
85
-        self::P_X5T => X509CertificateSHA1ThumbprintParameter::class,
86
-        self::P_X5TS256 => X509CertificateSHA256ThumbprintParameter::class,
87
-        self::P_CRV => CurveParameter::class,
88
-        self::P_X => XCoordinateParameter::class,
89
-        self::P_Y => YCoordinateParameter::class,
90
-        self::P_N => ModulusParameter::class,
91
-        self::P_E => ExponentParameter::class,
92
-        self::P_P => FirstPrimeFactorParameter::class,
93
-        self::P_Q => SecondPrimeFactorParameter::class,
94
-        self::P_DP => FirstFactorCRTExponentParameter::class,
95
-        self::P_DQ => SecondFactorCRTExponentParameter::class,
96
-        self::P_QI => FirstCRTCoefficientParameter::class,
97
-        self::P_OTH => OtherPrimesInfoParameter::class,
98
-        self::P_K => KeyValueParameter::class,
99
-    ];
67
+	/**
68
+	 * Mapping from registered JWK parameter name to class name.
69
+	 *
70
+	 * Note that ECC private key and RSA private key cannot be mapped since
71
+	 * they share the same parameter name 'd'.
72
+	 *
73
+	 * @internal
74
+	 *
75
+	 * @var array
76
+	 */
77
+	const MAP_NAME_TO_CLASS = [
78
+		self::P_KTY => KeyTypeParameter::class,
79
+		self::P_USE => PublicKeyUseParameter::class,
80
+		self::P_KEY_OPS => KeyOperationsParameter::class,
81
+		self::P_ALG => AlgorithmParameter::class,
82
+		self::P_KID => KeyIDParameter::class,
83
+		self::P_X5U => X509URLParameter::class,
84
+		self::P_X5C => X509CertificateChainParameter::class,
85
+		self::P_X5T => X509CertificateSHA1ThumbprintParameter::class,
86
+		self::P_X5TS256 => X509CertificateSHA256ThumbprintParameter::class,
87
+		self::P_CRV => CurveParameter::class,
88
+		self::P_X => XCoordinateParameter::class,
89
+		self::P_Y => YCoordinateParameter::class,
90
+		self::P_N => ModulusParameter::class,
91
+		self::P_E => ExponentParameter::class,
92
+		self::P_P => FirstPrimeFactorParameter::class,
93
+		self::P_Q => SecondPrimeFactorParameter::class,
94
+		self::P_DP => FirstFactorCRTExponentParameter::class,
95
+		self::P_DQ => SecondFactorCRTExponentParameter::class,
96
+		self::P_QI => FirstCRTCoefficientParameter::class,
97
+		self::P_OTH => OtherPrimesInfoParameter::class,
98
+		self::P_K => KeyValueParameter::class,
99
+	];
100 100
 
101
-    /**
102
-     * Constructor.
103
-     *
104
-     * @param string $name  Parameter name
105
-     * @param mixed  $value Parameter value
106
-     */
107
-    public function __construct(string $name, $value)
108
-    {
109
-        $this->_name = $name;
110
-        $this->_value = $value;
111
-    }
101
+	/**
102
+	 * Constructor.
103
+	 *
104
+	 * @param string $name  Parameter name
105
+	 * @param mixed  $value Parameter value
106
+	 */
107
+	public function __construct(string $name, $value)
108
+	{
109
+		$this->_name = $name;
110
+		$this->_value = $value;
111
+	}
112 112
 
113
-    /**
114
-     * Initialize from a name and a value.
115
-     *
116
-     * Returns a parameter specific object if one is implemented.
117
-     *
118
-     * @param string $name  Parameter name
119
-     * @param mixed  $value Parameter value
120
-     *
121
-     * @return self
122
-     */
123
-    public static function fromNameAndValue(string $name, $value): self
124
-    {
125
-        if (array_key_exists($name, self::MAP_NAME_TO_CLASS)) {
126
-            $cls = self::MAP_NAME_TO_CLASS[$name];
127
-            return $cls::fromJSONValue($value);
128
-        }
129
-        return new self($name, $value);
130
-    }
113
+	/**
114
+	 * Initialize from a name and a value.
115
+	 *
116
+	 * Returns a parameter specific object if one is implemented.
117
+	 *
118
+	 * @param string $name  Parameter name
119
+	 * @param mixed  $value Parameter value
120
+	 *
121
+	 * @return self
122
+	 */
123
+	public static function fromNameAndValue(string $name, $value): self
124
+	{
125
+		if (array_key_exists($name, self::MAP_NAME_TO_CLASS)) {
126
+			$cls = self::MAP_NAME_TO_CLASS[$name];
127
+			return $cls::fromJSONValue($value);
128
+		}
129
+		return new self($name, $value);
130
+	}
131 131
 
132
-    /**
133
-     * Initialize from a JSON value.
134
-     *
135
-     * @param mixed $value
136
-     *
137
-     * @return JWKParameter
138
-     */
139
-    public static function fromJSONValue($value): Parameter
140
-    {
141
-        throw new \BadMethodCallException(
142
-            __FUNCTION__ . ' must be implemented in a derived class.');
143
-    }
132
+	/**
133
+	 * Initialize from a JSON value.
134
+	 *
135
+	 * @param mixed $value
136
+	 *
137
+	 * @return JWKParameter
138
+	 */
139
+	public static function fromJSONValue($value): Parameter
140
+	{
141
+		throw new \BadMethodCallException(
142
+			__FUNCTION__ . ' must be implemented in a derived class.');
143
+	}
144 144
 }
Please login to merge, or discard this patch.