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 ( c4f121...b9594d )
by Joni
05:22
created
lib/JWX/JWK/JWKSet.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 "JWK Set must have a 'keys' member.");
66 66
         }
67 67
         $jwks = array_map(
68
-            function ($jwkdata) {
68
+            function($jwkdata) {
69 69
                 return JWK::fromArray($jwkdata);
70 70
             }, $members["keys"]);
71 71
         unset($members["keys"]);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     {
199 199
         $data = $this->_additional;
200 200
         $data["keys"] = array_map(
201
-            function (JWK $jwk) {
201
+            function(JWK $jwk) {
202 202
                 return $jwk->toArray();
203 203
             }, $this->_jwks);
204 204
         return $data;
Please login to merge, or discard this patch.
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -13,227 +13,227 @@
 block discarded – undo
13 13
  */
14 14
 class JWKSet implements \Countable, \IteratorAggregate
15 15
 {
16
-    /**
17
-     * JWK objects.
18
-     *
19
-     * @var JWK[] $_jwks
20
-     */
21
-    protected $_jwks;
22
-    
23
-    /**
24
-     * Additional members.
25
-     *
26
-     * @var array $_additional
27
-     */
28
-    protected $_additional;
29
-    
30
-    /**
31
-     * JWK mappings.
32
-     *
33
-     * @var array
34
-     */
35
-    private $_mappings = array();
36
-    
37
-    /**
38
-     * Constructor.
39
-     *
40
-     * @param JWK ...$jwks
41
-     */
42
-    public function __construct(JWK ...$jwks)
43
-    {
44
-        $this->_jwks = $jwks;
45
-        $this->_additional = array();
46
-    }
47
-    
48
-    /**
49
-     * Reset internal cache variables on clone.
50
-     */
51
-    public function __clone()
52
-    {
53
-        $this->_mappings = array();
54
-    }
55
-    
56
-    /**
57
-     * Initialize from an array representing a JSON object.
58
-     *
59
-     * @param array $members
60
-     * @throws \UnexpectedValueException
61
-     * @return self
62
-     */
63
-    public static function fromArray(array $members): self
64
-    {
65
-        if (!isset($members["keys"]) || !is_array($members["keys"])) {
66
-            throw new \UnexpectedValueException(
67
-                "JWK Set must have a 'keys' member.");
68
-        }
69
-        $jwks = array_map(
70
-            function ($jwkdata) {
71
-                return JWK::fromArray($jwkdata);
72
-            }, $members["keys"]);
73
-        unset($members["keys"]);
74
-        $obj = new self(...$jwks);
75
-        $obj->_additional = $members;
76
-        return $obj;
77
-    }
78
-    
79
-    /**
80
-     * Initialize from a JSON string.
81
-     *
82
-     * @param string $json
83
-     * @throws \UnexpectedValueException
84
-     * @return self
85
-     */
86
-    public static function fromJSON(string $json): self
87
-    {
88
-        $members = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
89
-        if (!is_array($members)) {
90
-            throw new \UnexpectedValueException("Invalid JSON.");
91
-        }
92
-        return self::fromArray($members);
93
-    }
94
-    
95
-    /**
96
-     * Get self with keys added.
97
-     *
98
-     * @param JWK ...$keys JWK objects
99
-     * @return self
100
-     */
101
-    public function withKeys(JWK ...$keys): self
102
-    {
103
-        $obj = clone $this;
104
-        $obj->_jwks = array_merge($obj->_jwks, $keys);
105
-        return $obj;
106
-    }
107
-    
108
-    /**
109
-     * Get all JWK's in a set.
110
-     *
111
-     * @return JWK[]
112
-     */
113
-    public function keys(): array
114
-    {
115
-        return $this->_jwks;
116
-    }
117
-    
118
-    /**
119
-     * Get the first JWK in the set.
120
-     *
121
-     * @throws \LogicException
122
-     * @return JWK
123
-     */
124
-    public function first(): JWK
125
-    {
126
-        if (!count($this->_jwks)) {
127
-            throw new \LogicException("No keys.");
128
-        }
129
-        return $this->_jwks[0];
130
-    }
131
-    
132
-    /**
133
-     * Get JWK by key ID.
134
-     *
135
-     * @param string $id
136
-     * @return JWK|null Null if not found
137
-     */
138
-    protected function _getKeyByID(string $id)
139
-    {
140
-        $map = $this->_getMapping(JWKParameter::PARAM_KEY_ID);
141
-        return isset($map[$id]) ? $map[$id] : null;
142
-    }
143
-    
144
-    /**
145
-     * Check whether set has a JWK with a given key ID.
146
-     *
147
-     * @param string $id
148
-     * @return bool
149
-     */
150
-    public function hasKeyID(string $id): bool
151
-    {
152
-        return $this->_getKeyByID($id) !== null;
153
-    }
154
-    
155
-    /**
156
-     * Get a JWK by a key ID.
157
-     *
158
-     * @param string $id
159
-     * @throws \LogicException
160
-     * @return JWK
161
-     */
162
-    public function keyByID(string $id): JWK
163
-    {
164
-        $jwk = $this->_getKeyByID($id);
165
-        if (!$jwk) {
166
-            throw new \LogicException("No key ID $id.");
167
-        }
168
-        return $jwk;
169
-    }
170
-    
171
-    /**
172
-     * Get mapping from parameter values of given parameter name to JWK.
173
-     *
174
-     * Later duplicate value shall override earlier JWK.
175
-     *
176
-     * @param string $name Parameter name
177
-     * @return array
178
-     */
179
-    protected function _getMapping(string $name): array
180
-    {
181
-        if (!isset($this->_mappings[$name])) {
182
-            $mapping = array();
183
-            foreach ($this->_jwks as $jwk) {
184
-                if ($jwk->has($name)) {
185
-                    $key = (string) $jwk->get($name)->value();
186
-                    $mapping[$key] = $jwk;
187
-                }
188
-            }
189
-            $this->_mappings[$name] = $mapping;
190
-        }
191
-        return $this->_mappings[$name];
192
-    }
193
-    
194
-    /**
195
-     * Convert to array.
196
-     *
197
-     * @return array
198
-     */
199
-    public function toArray(): array
200
-    {
201
-        $data = $this->_additional;
202
-        $data["keys"] = array_map(
203
-            function (JWK $jwk) {
204
-                return $jwk->toArray();
205
-            }, $this->_jwks);
206
-        return $data;
207
-    }
208
-    
209
-    /**
210
-     * Convert to JSON.
211
-     *
212
-     * @return string
213
-     */
214
-    public function toJSON(): string
215
-    {
216
-        return json_encode((object) $this->toArray(), JSON_UNESCAPED_SLASHES);
217
-    }
218
-    
219
-    /**
220
-     * Get the number of keys.
221
-     *
222
-     * @see \Countable::count()
223
-     */
224
-    public function count(): int
225
-    {
226
-        return count($this->_jwks);
227
-    }
228
-    
229
-    /**
230
-     * Get iterator for JWK objects.
231
-     *
232
-     * @see \IteratorAggregate::getIterator()
233
-     * @return \ArrayIterator
234
-     */
235
-    public function getIterator(): \ArrayIterator
236
-    {
237
-        return new \ArrayIterator($this->_jwks);
238
-    }
16
+	/**
17
+	 * JWK objects.
18
+	 *
19
+	 * @var JWK[] $_jwks
20
+	 */
21
+	protected $_jwks;
22
+    
23
+	/**
24
+	 * Additional members.
25
+	 *
26
+	 * @var array $_additional
27
+	 */
28
+	protected $_additional;
29
+    
30
+	/**
31
+	 * JWK mappings.
32
+	 *
33
+	 * @var array
34
+	 */
35
+	private $_mappings = array();
36
+    
37
+	/**
38
+	 * Constructor.
39
+	 *
40
+	 * @param JWK ...$jwks
41
+	 */
42
+	public function __construct(JWK ...$jwks)
43
+	{
44
+		$this->_jwks = $jwks;
45
+		$this->_additional = array();
46
+	}
47
+    
48
+	/**
49
+	 * Reset internal cache variables on clone.
50
+	 */
51
+	public function __clone()
52
+	{
53
+		$this->_mappings = array();
54
+	}
55
+    
56
+	/**
57
+	 * Initialize from an array representing a JSON object.
58
+	 *
59
+	 * @param array $members
60
+	 * @throws \UnexpectedValueException
61
+	 * @return self
62
+	 */
63
+	public static function fromArray(array $members): self
64
+	{
65
+		if (!isset($members["keys"]) || !is_array($members["keys"])) {
66
+			throw new \UnexpectedValueException(
67
+				"JWK Set must have a 'keys' member.");
68
+		}
69
+		$jwks = array_map(
70
+			function ($jwkdata) {
71
+				return JWK::fromArray($jwkdata);
72
+			}, $members["keys"]);
73
+		unset($members["keys"]);
74
+		$obj = new self(...$jwks);
75
+		$obj->_additional = $members;
76
+		return $obj;
77
+	}
78
+    
79
+	/**
80
+	 * Initialize from a JSON string.
81
+	 *
82
+	 * @param string $json
83
+	 * @throws \UnexpectedValueException
84
+	 * @return self
85
+	 */
86
+	public static function fromJSON(string $json): self
87
+	{
88
+		$members = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
89
+		if (!is_array($members)) {
90
+			throw new \UnexpectedValueException("Invalid JSON.");
91
+		}
92
+		return self::fromArray($members);
93
+	}
94
+    
95
+	/**
96
+	 * Get self with keys added.
97
+	 *
98
+	 * @param JWK ...$keys JWK objects
99
+	 * @return self
100
+	 */
101
+	public function withKeys(JWK ...$keys): self
102
+	{
103
+		$obj = clone $this;
104
+		$obj->_jwks = array_merge($obj->_jwks, $keys);
105
+		return $obj;
106
+	}
107
+    
108
+	/**
109
+	 * Get all JWK's in a set.
110
+	 *
111
+	 * @return JWK[]
112
+	 */
113
+	public function keys(): array
114
+	{
115
+		return $this->_jwks;
116
+	}
117
+    
118
+	/**
119
+	 * Get the first JWK in the set.
120
+	 *
121
+	 * @throws \LogicException
122
+	 * @return JWK
123
+	 */
124
+	public function first(): JWK
125
+	{
126
+		if (!count($this->_jwks)) {
127
+			throw new \LogicException("No keys.");
128
+		}
129
+		return $this->_jwks[0];
130
+	}
131
+    
132
+	/**
133
+	 * Get JWK by key ID.
134
+	 *
135
+	 * @param string $id
136
+	 * @return JWK|null Null if not found
137
+	 */
138
+	protected function _getKeyByID(string $id)
139
+	{
140
+		$map = $this->_getMapping(JWKParameter::PARAM_KEY_ID);
141
+		return isset($map[$id]) ? $map[$id] : null;
142
+	}
143
+    
144
+	/**
145
+	 * Check whether set has a JWK with a given key ID.
146
+	 *
147
+	 * @param string $id
148
+	 * @return bool
149
+	 */
150
+	public function hasKeyID(string $id): bool
151
+	{
152
+		return $this->_getKeyByID($id) !== null;
153
+	}
154
+    
155
+	/**
156
+	 * Get a JWK by a key ID.
157
+	 *
158
+	 * @param string $id
159
+	 * @throws \LogicException
160
+	 * @return JWK
161
+	 */
162
+	public function keyByID(string $id): JWK
163
+	{
164
+		$jwk = $this->_getKeyByID($id);
165
+		if (!$jwk) {
166
+			throw new \LogicException("No key ID $id.");
167
+		}
168
+		return $jwk;
169
+	}
170
+    
171
+	/**
172
+	 * Get mapping from parameter values of given parameter name to JWK.
173
+	 *
174
+	 * Later duplicate value shall override earlier JWK.
175
+	 *
176
+	 * @param string $name Parameter name
177
+	 * @return array
178
+	 */
179
+	protected function _getMapping(string $name): array
180
+	{
181
+		if (!isset($this->_mappings[$name])) {
182
+			$mapping = array();
183
+			foreach ($this->_jwks as $jwk) {
184
+				if ($jwk->has($name)) {
185
+					$key = (string) $jwk->get($name)->value();
186
+					$mapping[$key] = $jwk;
187
+				}
188
+			}
189
+			$this->_mappings[$name] = $mapping;
190
+		}
191
+		return $this->_mappings[$name];
192
+	}
193
+    
194
+	/**
195
+	 * Convert to array.
196
+	 *
197
+	 * @return array
198
+	 */
199
+	public function toArray(): array
200
+	{
201
+		$data = $this->_additional;
202
+		$data["keys"] = array_map(
203
+			function (JWK $jwk) {
204
+				return $jwk->toArray();
205
+			}, $this->_jwks);
206
+		return $data;
207
+	}
208
+    
209
+	/**
210
+	 * Convert to JSON.
211
+	 *
212
+	 * @return string
213
+	 */
214
+	public function toJSON(): string
215
+	{
216
+		return json_encode((object) $this->toArray(), JSON_UNESCAPED_SLASHES);
217
+	}
218
+    
219
+	/**
220
+	 * Get the number of keys.
221
+	 *
222
+	 * @see \Countable::count()
223
+	 */
224
+	public function count(): int
225
+	{
226
+		return count($this->_jwks);
227
+	}
228
+    
229
+	/**
230
+	 * Get iterator for JWK objects.
231
+	 *
232
+	 * @see \IteratorAggregate::getIterator()
233
+	 * @return \ArrayIterator
234
+	 */
235
+	public function getIterator(): \ArrayIterator
236
+	{
237
+		return new \ArrayIterator($this->_jwks);
238
+	}
239 239
 }
Please login to merge, or discard this patch.
lib/JWX/JWK/Parameter/OtherPrimesInfoParameter.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
  */
13 13
 class OtherPrimesInfoParameter extends JWKParameter
14 14
 {
15
-    use ArrayParameterValue;
15
+	use ArrayParameterValue;
16 16
     
17
-    /**
18
-     * Constructor.
19
-     *
20
-     * @param array[] ...$primes
21
-     */
22
-    public function __construct(...$primes)
23
-    {
24
-        parent::__construct(self::PARAM_OTHER_PRIMES_INFO, $primes);
25
-    }
17
+	/**
18
+	 * Constructor.
19
+	 *
20
+	 * @param array[] ...$primes
21
+	 */
22
+	public function __construct(...$primes)
23
+	{
24
+		parent::__construct(self::PARAM_OTHER_PRIMES_INFO, $primes);
25
+	}
26 26
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Claim/ExpirationTimeClaim.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@
 block discarded – undo
13 13
  */
14 14
 class ExpirationTimeClaim extends RegisteredClaim
15 15
 {
16
-    use NumericDateClaim;
17
-    use ReferenceTimeValidation;
16
+	use NumericDateClaim;
17
+	use ReferenceTimeValidation;
18 18
     
19
-    /**
20
-     * Constructor.
21
-     *
22
-     * @param int $exp_time Expiration time
23
-     */
24
-    public function __construct($exp_time)
25
-    {
26
-        // validate that claim is after the constraint (reference time)
27
-        parent::__construct(self::NAME_EXPIRATION_TIME, intval($exp_time),
28
-            new GreaterValidator());
29
-    }
19
+	/**
20
+	 * Constructor.
21
+	 *
22
+	 * @param int $exp_time Expiration time
23
+	 */
24
+	public function __construct($exp_time)
25
+	{
26
+		// validate that claim is after the constraint (reference time)
27
+		parent::__construct(self::NAME_EXPIRATION_TIME, intval($exp_time),
28
+			new GreaterValidator());
29
+	}
30 30
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Claim/RegisteredClaim.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -9,85 +9,85 @@
 block discarded – undo
9 9
  */
10 10
 abstract class RegisteredClaim extends Claim
11 11
 {
12
-    // JWT claims
13
-    const NAME_ISSUER = "iss";
14
-    const NAME_SUBJECT = "sub";
15
-    const NAME_AUDIENCE = "aud";
16
-    const NAME_EXPIRATION_TIME = "exp";
17
-    const NAME_NOT_BEFORE = "nbf";
18
-    const NAME_ISSUED_AT = "iat";
19
-    const NAME_JWT_ID = "jti";
12
+	// JWT claims
13
+	const NAME_ISSUER = "iss";
14
+	const NAME_SUBJECT = "sub";
15
+	const NAME_AUDIENCE = "aud";
16
+	const NAME_EXPIRATION_TIME = "exp";
17
+	const NAME_NOT_BEFORE = "nbf";
18
+	const NAME_ISSUED_AT = "iat";
19
+	const NAME_JWT_ID = "jti";
20 20
     
21
-    // OpenID claims
22
-    const NAME_FULL_NAME = "name";
23
-    const NAME_GIVEN_NAME = "given_name";
24
-    const NAME_FAMILY_NAME = "family_name";
25
-    const NAME_MIDDLE_NAME = "middle_name";
26
-    const NAME_NICKNAME = "nickname";
27
-    const NAME_PREFERRED_USERNAME = "preferred_username";
28
-    const NAME_PROFILE_URL = "profile";
29
-    const NAME_PICTURE_URL = "picture";
30
-    const NAME_WEBSITE_URL = "website";
31
-    const NAME_EMAIL = "email";
32
-    const NAME_EMAIL_VERIFIED = "email_verified";
33
-    const NAME_GENDER = "gender";
34
-    const NAME_BIRTHDATE = "birthdate";
35
-    const NAME_TIMEZONE = "zoneinfo";
36
-    const NAME_LOCALE = "locale";
37
-    const NAME_PHONE_NUMBER = "phone_number";
38
-    const NAME_PHONE_NUMBER_VERIFIED = "phone_number_verified";
39
-    const NAME_ADDRESS = "address";
40
-    const NAME_UPDATED_AT = "updated_at";
41
-    const NAME_AUTHORIZED_PARTY = "azp";
42
-    const NAME_NONCE = "nonce";
43
-    const NAME_AUTH_TIME = "auth_time";
44
-    const NAME_ACCESS_TOKEN_HASH = "at_hash";
45
-    const NAME_CODE_HASH = "c_hash";
46
-    const NAME_ACR = "acr";
47
-    const NAME_AMR = "amr";
48
-    const NAME_SUB_JWK = "sub_jwk";
21
+	// OpenID claims
22
+	const NAME_FULL_NAME = "name";
23
+	const NAME_GIVEN_NAME = "given_name";
24
+	const NAME_FAMILY_NAME = "family_name";
25
+	const NAME_MIDDLE_NAME = "middle_name";
26
+	const NAME_NICKNAME = "nickname";
27
+	const NAME_PREFERRED_USERNAME = "preferred_username";
28
+	const NAME_PROFILE_URL = "profile";
29
+	const NAME_PICTURE_URL = "picture";
30
+	const NAME_WEBSITE_URL = "website";
31
+	const NAME_EMAIL = "email";
32
+	const NAME_EMAIL_VERIFIED = "email_verified";
33
+	const NAME_GENDER = "gender";
34
+	const NAME_BIRTHDATE = "birthdate";
35
+	const NAME_TIMEZONE = "zoneinfo";
36
+	const NAME_LOCALE = "locale";
37
+	const NAME_PHONE_NUMBER = "phone_number";
38
+	const NAME_PHONE_NUMBER_VERIFIED = "phone_number_verified";
39
+	const NAME_ADDRESS = "address";
40
+	const NAME_UPDATED_AT = "updated_at";
41
+	const NAME_AUTHORIZED_PARTY = "azp";
42
+	const NAME_NONCE = "nonce";
43
+	const NAME_AUTH_TIME = "auth_time";
44
+	const NAME_ACCESS_TOKEN_HASH = "at_hash";
45
+	const NAME_CODE_HASH = "c_hash";
46
+	const NAME_ACR = "acr";
47
+	const NAME_AMR = "amr";
48
+	const NAME_SUB_JWK = "sub_jwk";
49 49
     
50
-    /**
51
-     * Mapping from registered claim name to class name.
52
-     *
53
-     * @internal
54
-     *
55
-     * @var array
56
-     */
57
-    const MAP_NAME_TO_CLASS = array(
58
-        /* @formatter:off */
59
-        self::NAME_ISSUER => IssuerClaim::class,
60
-        self::NAME_SUBJECT => SubjectClaim::class,
61
-        self::NAME_AUDIENCE => AudienceClaim::class,
62
-        self::NAME_EXPIRATION_TIME => ExpirationTimeClaim::class,
63
-        self::NAME_NOT_BEFORE => NotBeforeClaim::class,
64
-        self::NAME_ISSUED_AT => IssuedAtClaim::class,
65
-        self::NAME_JWT_ID => JWTIDClaim::class
66
-        /* @formatter:on */
67
-    );
50
+	/**
51
+	 * Mapping from registered claim name to class name.
52
+	 *
53
+	 * @internal
54
+	 *
55
+	 * @var array
56
+	 */
57
+	const MAP_NAME_TO_CLASS = array(
58
+		/* @formatter:off */
59
+		self::NAME_ISSUER => IssuerClaim::class,
60
+		self::NAME_SUBJECT => SubjectClaim::class,
61
+		self::NAME_AUDIENCE => AudienceClaim::class,
62
+		self::NAME_EXPIRATION_TIME => ExpirationTimeClaim::class,
63
+		self::NAME_NOT_BEFORE => NotBeforeClaim::class,
64
+		self::NAME_ISSUED_AT => IssuedAtClaim::class,
65
+		self::NAME_JWT_ID => JWTIDClaim::class
66
+		/* @formatter:on */
67
+	);
68 68
     
69
-    /**
70
-     * Constructor.
71
-     *
72
-     * Defined here for type strictness. Parameters are passed to the
73
-     * superclass.
74
-     *
75
-     * @param mixed ...$args
76
-     */
77
-    public function __construct(...$args)
78
-    {
79
-        parent::__construct((string) $args[0], $args[1],
80
-            isset($args[2]) ? $args[2] : null);
81
-    }
69
+	/**
70
+	 * Constructor.
71
+	 *
72
+	 * Defined here for type strictness. Parameters are passed to the
73
+	 * superclass.
74
+	 *
75
+	 * @param mixed ...$args
76
+	 */
77
+	public function __construct(...$args)
78
+	{
79
+		parent::__construct((string) $args[0], $args[1],
80
+			isset($args[2]) ? $args[2] : null);
81
+	}
82 82
     
83
-    /**
84
-     * Initialize concrete claim instance from a JSON value.
85
-     *
86
-     * @param mixed $value
87
-     * @return RegisteredClaim
88
-     */
89
-    public static function fromJSONValue($value)
90
-    {
91
-        return new static($value);
92
-    }
83
+	/**
84
+	 * Initialize concrete claim instance from a JSON value.
85
+	 *
86
+	 * @param mixed $value
87
+	 * @return RegisteredClaim
88
+	 */
89
+	public static function fromJSONValue($value)
90
+	{
91
+		return new static($value);
92
+	}
93 93
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Parameter/ReplicatedClaimParameter.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
  */
12 12
 class ReplicatedClaimParameter extends JWTParameter
13 13
 {
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param Claim $claim
18
-     */
19
-    public function __construct(Claim $claim)
20
-    {
21
-        parent::__construct($claim->name(), $claim->value());
22
-    }
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param Claim $claim
18
+	 */
19
+	public function __construct(Claim $claim)
20
+	{
21
+		parent::__construct($claim->name(), $claim->value());
22
+	}
23 23
 }
Please login to merge, or discard this patch.
lib/JWX/Util/UUIDv4.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@
 block discarded – undo
70 70
             // time_mid
71 71
             mt_rand(0, 0xffff), 
72 72
             // time_hi_and_version
73
-            mt_rand(0, 0x0fff) | 0x4000, 
73
+            mt_rand(0, 0x0fff)|0x4000, 
74 74
             // clk_seq_hi_res
75
-            mt_rand(0, 0x3f) | 0x80, 
75
+            mt_rand(0, 0x3f)|0x80, 
76 76
             // clk_seq_low
77 77
             mt_rand(0, 0xff), 
78 78
             // node
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -30,32 +30,32 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class UUIDv4
32 32
 {
33
-    /**
34
-     * UUID.
35
-     *
36
-     * @var string $_uuid
37
-     */
38
-    protected $_uuid;
33
+	/**
34
+	 * UUID.
35
+	 *
36
+	 * @var string $_uuid
37
+	 */
38
+	protected $_uuid;
39 39
     
40
-    /**
41
-     * Constructor.
42
-     *
43
-     * @param string $uuid UUIDv4 in canonical hexadecimal format
44
-     */
45
-    public function __construct(string $uuid)
46
-    {
47
-        // @todo Check that UUID is version 4
48
-        $this->_uuid = $uuid;
49
-    }
40
+	/**
41
+	 * Constructor.
42
+	 *
43
+	 * @param string $uuid UUIDv4 in canonical hexadecimal format
44
+	 */
45
+	public function __construct(string $uuid)
46
+	{
47
+		// @todo Check that UUID is version 4
48
+		$this->_uuid = $uuid;
49
+	}
50 50
     
51
-    /**
52
-     * Create new random UUIDv4.
53
-     *
54
-     * @return self
55
-     */
56
-    public static function createRandom(): self
57
-    {
58
-        /*
51
+	/**
52
+	 * Create new random UUIDv4.
53
+	 *
54
+	 * @return self
55
+	 */
56
+	public static function createRandom(): self
57
+	{
58
+		/*
59 59
          1. Set the two most significant bits (bits 6 and 7) of
60 60
          the clock_seq_hi_and_reserved to zero and one, respectively.
61 61
          
@@ -66,38 +66,38 @@  discard block
 block discarded – undo
66 66
          3. Set all the other bits to randomly (or pseudo-randomly)
67 67
          chosen values.
68 68
          */
69
-        $uuid = sprintf("%04x%04x-%04x-%04x-%02x%02x-%04x%04x%04x",
70
-            // time_low
71
-            mt_rand(0, 0xffff), mt_rand(0, 0xffff), 
72
-            // time_mid
73
-            mt_rand(0, 0xffff), 
74
-            // time_hi_and_version
75
-            mt_rand(0, 0x0fff) | 0x4000, 
76
-            // clk_seq_hi_res
77
-            mt_rand(0, 0x3f) | 0x80, 
78
-            // clk_seq_low
79
-            mt_rand(0, 0xff), 
80
-            // node
81
-            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
82
-        return new self($uuid);
83
-    }
69
+		$uuid = sprintf("%04x%04x-%04x-%04x-%02x%02x-%04x%04x%04x",
70
+			// time_low
71
+			mt_rand(0, 0xffff), mt_rand(0, 0xffff), 
72
+			// time_mid
73
+			mt_rand(0, 0xffff), 
74
+			// time_hi_and_version
75
+			mt_rand(0, 0x0fff) | 0x4000, 
76
+			// clk_seq_hi_res
77
+			mt_rand(0, 0x3f) | 0x80, 
78
+			// clk_seq_low
79
+			mt_rand(0, 0xff), 
80
+			// node
81
+			mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
82
+		return new self($uuid);
83
+	}
84 84
     
85
-    /**
86
-     * Get UUIDv4 in canonical form.
87
-     *
88
-     * @return string
89
-     */
90
-    public function canonical(): string
91
-    {
92
-        return $this->_uuid;
93
-    }
85
+	/**
86
+	 * Get UUIDv4 in canonical form.
87
+	 *
88
+	 * @return string
89
+	 */
90
+	public function canonical(): string
91
+	{
92
+		return $this->_uuid;
93
+	}
94 94
     
95
-    /**
96
-     *
97
-     * @return string
98
-     */
99
-    public function __toString()
100
-    {
101
-        return $this->canonical();
102
-    }
95
+	/**
96
+	 *
97
+	 * @return string
98
+	 */
99
+	public function __toString()
100
+	{
101
+		return $this->canonical();
102
+	}
103 103
 }
Please login to merge, or discard this patch.
lib/JWX/Parameter/Feature/ArrayParameterValue.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@
 block discarded – undo
7 7
  */
8 8
 trait ArrayParameterValue
9 9
 {
10
-    /**
11
-     * Constructor.
12
-     *
13
-     * @param mixed ...$values
14
-     */
15
-    abstract public function __construct(...$values);
10
+	/**
11
+	 * Constructor.
12
+	 *
13
+	 * @param mixed ...$values
14
+	 */
15
+	abstract public function __construct(...$values);
16 16
     
17
-    /**
18
-     * Initialize from a JSON value.
19
-     *
20
-     * @param array $value
21
-     * @return static
22
-     */
23
-    public static function fromJSONValue($value)
24
-    {
25
-        if (!is_array($value)) {
26
-            throw new \UnexpectedValueException(
27
-                get_called_class() . " expects an array parameter.");
28
-        }
29
-        return new static(...$value);
30
-    }
17
+	/**
18
+	 * Initialize from a JSON value.
19
+	 *
20
+	 * @param array $value
21
+	 * @return static
22
+	 */
23
+	public static function fromJSONValue($value)
24
+	{
25
+		if (!is_array($value)) {
26
+			throw new \UnexpectedValueException(
27
+				get_called_class() . " expects an array parameter.");
28
+		}
29
+		return new static(...$value);
30
+	}
31 31
 }
Please login to merge, or discard this patch.
lib/JWX/JWS/Algorithm/HMACAlgorithm.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -18,92 +18,92 @@
 block discarded – undo
18 18
  */
19 19
 abstract class HMACAlgorithm extends SignatureAlgorithm
20 20
 {
21
-    /**
22
-     * Shared secret key.
23
-     *
24
-     * @var string $_key
25
-     */
26
-    protected $_key;
21
+	/**
22
+	 * Shared secret key.
23
+	 *
24
+	 * @var string $_key
25
+	 */
26
+	protected $_key;
27 27
     
28
-    /**
29
-     * Mapping from algorithm name to class name.
30
-     *
31
-     * @internal
32
-     *
33
-     * @var array
34
-     */
35
-    const MAP_ALGO_TO_CLASS = array(
36
-        /* @formatter:off */
37
-        JWA::ALGO_HS256 => HS256Algorithm::class, 
38
-        JWA::ALGO_HS384 => HS384Algorithm::class, 
39
-        JWA::ALGO_HS512 => HS512Algorithm::class
40
-        /* @formatter:on */
41
-    );
28
+	/**
29
+	 * Mapping from algorithm name to class name.
30
+	 *
31
+	 * @internal
32
+	 *
33
+	 * @var array
34
+	 */
35
+	const MAP_ALGO_TO_CLASS = array(
36
+		/* @formatter:off */
37
+		JWA::ALGO_HS256 => HS256Algorithm::class, 
38
+		JWA::ALGO_HS384 => HS384Algorithm::class, 
39
+		JWA::ALGO_HS512 => HS512Algorithm::class
40
+		/* @formatter:on */
41
+	);
42 42
     
43
-    /**
44
-     * Get algorithm name recognized by the Hash extension.
45
-     *
46
-     * @return string
47
-     */
48
-    abstract protected function _hashAlgo(): string;
43
+	/**
44
+	 * Get algorithm name recognized by the Hash extension.
45
+	 *
46
+	 * @return string
47
+	 */
48
+	abstract protected function _hashAlgo(): string;
49 49
     
50
-    /**
51
-     * Constructor.
52
-     *
53
-     * @param string $key Shared secret key
54
-     */
55
-    public function __construct(string $key)
56
-    {
57
-        $this->_key = $key;
58
-    }
50
+	/**
51
+	 * Constructor.
52
+	 *
53
+	 * @param string $key Shared secret key
54
+	 */
55
+	public function __construct(string $key)
56
+	{
57
+		$this->_key = $key;
58
+	}
59 59
     
60
-    /**
61
-     *
62
-     * {@inheritdoc}
63
-     */
64
-    public static function fromJWK(JWK $jwk, Header $header): self
65
-    {
66
-        $jwk = SymmetricKeyJWK::fromJWK($jwk);
67
-        $alg = JWA::deriveAlgorithmName($header, $jwk);
68
-        if (!array_key_exists($alg, self::MAP_ALGO_TO_CLASS)) {
69
-            throw new \UnexpectedValueException("Unsupported algorithm '$alg'.");
70
-        }
71
-        $cls = self::MAP_ALGO_TO_CLASS[$alg];
72
-        return new $cls($jwk->key());
73
-    }
60
+	/**
61
+	 *
62
+	 * {@inheritdoc}
63
+	 */
64
+	public static function fromJWK(JWK $jwk, Header $header): self
65
+	{
66
+		$jwk = SymmetricKeyJWK::fromJWK($jwk);
67
+		$alg = JWA::deriveAlgorithmName($header, $jwk);
68
+		if (!array_key_exists($alg, self::MAP_ALGO_TO_CLASS)) {
69
+			throw new \UnexpectedValueException("Unsupported algorithm '$alg'.");
70
+		}
71
+		$cls = self::MAP_ALGO_TO_CLASS[$alg];
72
+		return new $cls($jwk->key());
73
+	}
74 74
     
75
-    /**
76
-     *
77
-     * {@inheritdoc}
78
-     */
79
-    public function computeSignature(string $data): string
80
-    {
81
-        $result = @hash_hmac($this->_hashAlgo(), $data, $this->_key, true);
82
-        if (false === $result) {
83
-            $err = error_get_last();
84
-            $msg = isset($err) && __FILE__ == $err['file'] ? $err['message'] : null;
85
-            throw new \RuntimeException($msg ?? 'hash_hmac() failed.');
86
-        }
87
-        return $result;
88
-    }
75
+	/**
76
+	 *
77
+	 * {@inheritdoc}
78
+	 */
79
+	public function computeSignature(string $data): string
80
+	{
81
+		$result = @hash_hmac($this->_hashAlgo(), $data, $this->_key, true);
82
+		if (false === $result) {
83
+			$err = error_get_last();
84
+			$msg = isset($err) && __FILE__ == $err['file'] ? $err['message'] : null;
85
+			throw new \RuntimeException($msg ?? 'hash_hmac() failed.');
86
+		}
87
+		return $result;
88
+	}
89 89
     
90
-    /**
91
-     *
92
-     * {@inheritdoc}
93
-     */
94
-    public function validateSignature(string $data, string $signature): bool
95
-    {
96
-        return $this->computeSignature($data) === $signature;
97
-    }
90
+	/**
91
+	 *
92
+	 * {@inheritdoc}
93
+	 */
94
+	public function validateSignature(string $data, string $signature): bool
95
+	{
96
+		return $this->computeSignature($data) === $signature;
97
+	}
98 98
     
99
-    /**
100
-     *
101
-     * @see \JWX\JWS\SignatureAlgorithm::headerParameters()
102
-     * @return \JWX\JWT\Parameter\JWTParameter[]
103
-     */
104
-    public function headerParameters(): array
105
-    {
106
-        return array_merge(parent::headerParameters(),
107
-            array(AlgorithmParameter::fromAlgorithm($this)));
108
-    }
99
+	/**
100
+	 *
101
+	 * @see \JWX\JWS\SignatureAlgorithm::headerParameters()
102
+	 * @return \JWX\JWT\Parameter\JWTParameter[]
103
+	 */
104
+	public function headerParameters(): array
105
+	{
106
+		return array_merge(parent::headerParameters(),
107
+			array(AlgorithmParameter::fromAlgorithm($this)));
108
+	}
109 109
 }
Please login to merge, or discard this patch.
lib/JWX/JWS/Algorithm/HS256Algorithm.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@
 block discarded – undo
13 13
  */
14 14
 class HS256Algorithm extends HMACAlgorithm
15 15
 {
16
-    /**
17
-     *
18
-     * {@inheritdoc}
19
-     */
20
-    protected function _hashAlgo(): string
21
-    {
22
-        return "sha256";
23
-    }
16
+	/**
17
+	 *
18
+	 * {@inheritdoc}
19
+	 */
20
+	protected function _hashAlgo(): string
21
+	{
22
+		return "sha256";
23
+	}
24 24
     
25
-    /**
26
-     *
27
-     * {@inheritdoc}
28
-     */
29
-    public function algorithmParamValue(): string
30
-    {
31
-        return JWA::ALGO_HS256;
32
-    }
25
+	/**
26
+	 *
27
+	 * {@inheritdoc}
28
+	 */
29
+	public function algorithmParamValue(): string
30
+	{
31
+		return JWA::ALGO_HS256;
32
+	}
33 33
 }
Please login to merge, or discard this patch.