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 ( d79416...c4f121 )
by Joni
03:43
created
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/JWT/Parameter/AuthenticationTagParameter.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@
 block discarded – undo
11 11
  */
12 12
 class AuthenticationTagParameter extends JWTParameter
13 13
 {
14
-    use Base64URLValue;
14
+	use Base64URLValue;
15 15
     
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @param string $tag Base64url encoded authentication tag
20
-     */
21
-    public function __construct($tag)
22
-    {
23
-        $this->_validateEncoding($tag);
24
-        parent::__construct(self::PARAM_AUTHENTICATION_TAG, (string) $tag);
25
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @param string $tag Base64url encoded authentication tag
20
+	 */
21
+	public function __construct($tag)
22
+	{
23
+		$this->_validateEncoding($tag);
24
+		parent::__construct(self::PARAM_AUTHENTICATION_TAG, (string) $tag);
25
+	}
26 26
     
27
-    /**
28
-     * Get the authentication tag.
29
-     *
30
-     * @return string
31
-     */
32
-    public function authenticationTag()
33
-    {
34
-        return $this->string();
35
-    }
27
+	/**
28
+	 * Get the authentication tag.
29
+	 *
30
+	 * @return string
31
+	 */
32
+	public function authenticationTag()
33
+	{
34
+		return $this->string();
35
+	}
36 36
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Parameter/CompressionAlgorithmParameterValue.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
  */
8 8
 interface CompressionAlgorithmParameterValue
9 9
 {
10
-    /**
11
-     * Get compression algorithm type as an 'zip' parameter value.
12
-     *
13
-     * @return string
14
-     */
15
-    public function compressionParamValue();
10
+	/**
11
+	 * Get compression algorithm type as an 'zip' parameter value.
12
+	 *
13
+	 * @return string
14
+	 */
15
+	public function compressionParamValue();
16 16
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Parameter/CriticalParameter.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -11,50 +11,50 @@
 block discarded – undo
11 11
  */
12 12
 class CriticalParameter extends JWTParameter
13 13
 {
14
-    use ArrayParameterValue;
14
+	use ArrayParameterValue;
15 15
     
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @param string ...$names
20
-     */
21
-    public function __construct(...$names)
22
-    {
23
-        parent::__construct(self::PARAM_CRITICAL, $names);
24
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @param string ...$names
20
+	 */
21
+	public function __construct(...$names)
22
+	{
23
+		parent::__construct(self::PARAM_CRITICAL, $names);
24
+	}
25 25
     
26
-    /**
27
-     * Get self with parameter name added.
28
-     *
29
-     * @param string $name
30
-     * @return self
31
-     */
32
-    public function withParamName($name)
33
-    {
34
-        $obj = clone $this;
35
-        $obj->_value[] = $name;
36
-        $obj->_value = array_values(array_unique($obj->_value));
37
-        return $obj;
38
-    }
26
+	/**
27
+	 * Get self with parameter name added.
28
+	 *
29
+	 * @param string $name
30
+	 * @return self
31
+	 */
32
+	public function withParamName($name)
33
+	{
34
+		$obj = clone $this;
35
+		$obj->_value[] = $name;
36
+		$obj->_value = array_values(array_unique($obj->_value));
37
+		return $obj;
38
+	}
39 39
     
40
-    /**
41
-     * Check whether given parameter name is critical.
42
-     *
43
-     * @param string $name
44
-     * @return bool
45
-     */
46
-    public function has($name)
47
-    {
48
-        return false !== array_search($name, $this->_value);
49
-    }
40
+	/**
41
+	 * Check whether given parameter name is critical.
42
+	 *
43
+	 * @param string $name
44
+	 * @return bool
45
+	 */
46
+	public function has($name)
47
+	{
48
+		return false !== array_search($name, $this->_value);
49
+	}
50 50
     
51
-    /**
52
-     * Get critical header parameter names.
53
-     *
54
-     * @return string[]
55
-     */
56
-    public function names()
57
-    {
58
-        return $this->_value;
59
-    }
51
+	/**
52
+	 * Get critical header parameter names.
53
+	 *
54
+	 * @return string[]
55
+	 */
56
+	public function names()
57
+	{
58
+		return $this->_value;
59
+	}
60 60
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Parameter/AlgorithmParameterValue.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
  */
8 8
 interface AlgorithmParameterValue
9 9
 {
10
-    /**
11
-     * Get algorithm type as an 'alg' parameter value.
12
-     *
13
-     * @return string
14
-     */
15
-    public function algorithmParamValue();
10
+	/**
11
+	 * Get algorithm type as an 'alg' parameter value.
12
+	 *
13
+	 * @return string
14
+	 */
15
+	public function algorithmParamValue();
16 16
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Parameter/EncryptionAlgorithmParameter.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,27 +11,27 @@
 block discarded – undo
11 11
  */
12 12
 class EncryptionAlgorithmParameter extends JWTParameter
13 13
 {
14
-    use StringParameterValue;
14
+	use StringParameterValue;
15 15
     
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @param string $algo Algorithm name
20
-     */
21
-    public function __construct($algo)
22
-    {
23
-        parent::__construct(self::PARAM_ENCRYPTION_ALGORITHM, $algo);
24
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @param string $algo Algorithm name
20
+	 */
21
+	public function __construct($algo)
22
+	{
23
+		parent::__construct(self::PARAM_ENCRYPTION_ALGORITHM, $algo);
24
+	}
25 25
     
26
-    /**
27
-     * Initialize from EncryptionAlgorithmParameterValue.
28
-     *
29
-     * @param EncryptionAlgorithmParameterValue $value
30
-     * @return self
31
-     */
32
-    public static function fromAlgorithm(
33
-        EncryptionAlgorithmParameterValue $value)
34
-    {
35
-        return new self($value->encryptionAlgorithmParamValue());
36
-    }
26
+	/**
27
+	 * Initialize from EncryptionAlgorithmParameterValue.
28
+	 *
29
+	 * @param EncryptionAlgorithmParameterValue $value
30
+	 * @return self
31
+	 */
32
+	public static function fromAlgorithm(
33
+		EncryptionAlgorithmParameterValue $value)
34
+	{
35
+		return new self($value->encryptionAlgorithmParamValue());
36
+	}
37 37
 }
Please login to merge, or discard this patch.
lib/JWX/JWT/Claims.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -12,158 +12,158 @@
 block discarded – undo
12 12
  */
13 13
 class Claims implements \Countable, \IteratorAggregate
14 14
 {
15
-    use TypedClaims;
15
+	use TypedClaims;
16 16
     
17
-    /**
18
-     * Claims.
19
-     *
20
-     * @var Claim[] $_claims
21
-     */
22
-    protected $_claims;
17
+	/**
18
+	 * Claims.
19
+	 *
20
+	 * @var Claim[] $_claims
21
+	 */
22
+	protected $_claims;
23 23
     
24
-    /**
25
-     * Constructor.
26
-     *
27
-     * @param Claim ...$claims Zero or more claims
28
-     */
29
-    public function __construct(Claim ...$claims)
30
-    {
31
-        $this->_claims = array();
32
-        foreach ($claims as $claim) {
33
-            $this->_claims[$claim->name()] = $claim;
34
-        }
35
-    }
24
+	/**
25
+	 * Constructor.
26
+	 *
27
+	 * @param Claim ...$claims Zero or more claims
28
+	 */
29
+	public function __construct(Claim ...$claims)
30
+	{
31
+		$this->_claims = array();
32
+		foreach ($claims as $claim) {
33
+			$this->_claims[$claim->name()] = $claim;
34
+		}
35
+	}
36 36
     
37
-    /**
38
-     * Initialize from a JSON string.
39
-     *
40
-     * @param string $json JSON
41
-     * @throws \UnexpectedValueException If JSON is malformed
42
-     * @return self
43
-     */
44
-    public static function fromJSON($json)
45
-    {
46
-        $claims = array();
47
-        $fields = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
48
-        if (!is_array($fields)) {
49
-            throw new \UnexpectedValueException("Invalid JSON.");
50
-        }
51
-        foreach ($fields as $name => $value) {
52
-            $claims[] = Claim::fromNameAndValue($name, $value);
53
-        }
54
-        return new self(...$claims);
55
-    }
37
+	/**
38
+	 * Initialize from a JSON string.
39
+	 *
40
+	 * @param string $json JSON
41
+	 * @throws \UnexpectedValueException If JSON is malformed
42
+	 * @return self
43
+	 */
44
+	public static function fromJSON($json)
45
+	{
46
+		$claims = array();
47
+		$fields = json_decode($json, true, 32, JSON_BIGINT_AS_STRING);
48
+		if (!is_array($fields)) {
49
+			throw new \UnexpectedValueException("Invalid JSON.");
50
+		}
51
+		foreach ($fields as $name => $value) {
52
+			$claims[] = Claim::fromNameAndValue($name, $value);
53
+		}
54
+		return new self(...$claims);
55
+	}
56 56
     
57
-    /**
58
-     * Get self with Claim objects added.
59
-     *
60
-     * @param Claim ...$claims One or more Claim objects
61
-     * @return self
62
-     */
63
-    public function withClaims(Claim ...$claims)
64
-    {
65
-        $obj = clone $this;
66
-        foreach ($claims as $claim) {
67
-            $obj->_claims[$claim->name()] = $claim;
68
-        }
69
-        return $obj;
70
-    }
57
+	/**
58
+	 * Get self with Claim objects added.
59
+	 *
60
+	 * @param Claim ...$claims One or more Claim objects
61
+	 * @return self
62
+	 */
63
+	public function withClaims(Claim ...$claims)
64
+	{
65
+		$obj = clone $this;
66
+		foreach ($claims as $claim) {
67
+			$obj->_claims[$claim->name()] = $claim;
68
+		}
69
+		return $obj;
70
+	}
71 71
     
72
-    /**
73
-     * Get all claims.
74
-     *
75
-     * @return Claim[]
76
-     */
77
-    public function all()
78
-    {
79
-        return $this->_claims;
80
-    }
72
+	/**
73
+	 * Get all claims.
74
+	 *
75
+	 * @return Claim[]
76
+	 */
77
+	public function all()
78
+	{
79
+		return $this->_claims;
80
+	}
81 81
     
82
-    /**
83
-     * Check whether claim is present.
84
-     *
85
-     * @param string $name Claim name
86
-     * @return true
87
-     */
88
-    public function has($name)
89
-    {
90
-        return isset($this->_claims[$name]);
91
-    }
82
+	/**
83
+	 * Check whether claim is present.
84
+	 *
85
+	 * @param string $name Claim name
86
+	 * @return true
87
+	 */
88
+	public function has($name)
89
+	{
90
+		return isset($this->_claims[$name]);
91
+	}
92 92
     
93
-    /**
94
-     * Get claim by name.
95
-     *
96
-     * @param string $name Claim name
97
-     * @throws \LogicException If claim is not present
98
-     * @return Claim
99
-     */
100
-    public function get($name)
101
-    {
102
-        if (!isset($this->_claims[$name])) {
103
-            throw new \LogicException("Claim $name not set.");
104
-        }
105
-        return $this->_claims[$name];
106
-    }
93
+	/**
94
+	 * Get claim by name.
95
+	 *
96
+	 * @param string $name Claim name
97
+	 * @throws \LogicException If claim is not present
98
+	 * @return Claim
99
+	 */
100
+	public function get($name)
101
+	{
102
+		if (!isset($this->_claims[$name])) {
103
+			throw new \LogicException("Claim $name not set.");
104
+		}
105
+		return $this->_claims[$name];
106
+	}
107 107
     
108
-    /**
109
-     * Convert to a JSON.
110
-     *
111
-     * @return string
112
-     */
113
-    public function toJSON()
114
-    {
115
-        $data = array();
116
-        foreach ($this->_claims as $claim) {
117
-            $data[$claim->name()] = $claim->value();
118
-        }
119
-        return json_encode((object) $data, JSON_UNESCAPED_SLASHES);
120
-    }
108
+	/**
109
+	 * Convert to a JSON.
110
+	 *
111
+	 * @return string
112
+	 */
113
+	public function toJSON()
114
+	{
115
+		$data = array();
116
+		foreach ($this->_claims as $claim) {
117
+			$data[$claim->name()] = $claim->value();
118
+		}
119
+		return json_encode((object) $data, JSON_UNESCAPED_SLASHES);
120
+	}
121 121
     
122
-    /**
123
-     * Check whether a claims set is valid in the given context.
124
-     *
125
-     * @param ValidationContext $ctx Validation context
126
-     * @return bool
127
-     */
128
-    public function isValid(ValidationContext $ctx)
129
-    {
130
-        try {
131
-            $ctx->validate($this);
132
-        } catch (\RuntimeException $e) {
133
-            return false;
134
-        }
135
-        return true;
136
-    }
122
+	/**
123
+	 * Check whether a claims set is valid in the given context.
124
+	 *
125
+	 * @param ValidationContext $ctx Validation context
126
+	 * @return bool
127
+	 */
128
+	public function isValid(ValidationContext $ctx)
129
+	{
130
+		try {
131
+			$ctx->validate($this);
132
+		} catch (\RuntimeException $e) {
133
+			return false;
134
+		}
135
+		return true;
136
+	}
137 137
     
138
-    /**
139
-     * Get the number of claims.
140
-     *
141
-     * @see \Countable::count()
142
-     * @return int
143
-     */
144
-    public function count()
145
-    {
146
-        return count($this->_claims);
147
-    }
138
+	/**
139
+	 * Get the number of claims.
140
+	 *
141
+	 * @see \Countable::count()
142
+	 * @return int
143
+	 */
144
+	public function count()
145
+	{
146
+		return count($this->_claims);
147
+	}
148 148
     
149
-    /**
150
-     * Get iterator for Claim objects keyed by claim name.
151
-     *
152
-     * @see \IteratorAggregate::getIterator()
153
-     * @return \ArrayIterator
154
-     */
155
-    public function getIterator()
156
-    {
157
-        return new \ArrayIterator($this->_claims);
158
-    }
149
+	/**
150
+	 * Get iterator for Claim objects keyed by claim name.
151
+	 *
152
+	 * @see \IteratorAggregate::getIterator()
153
+	 * @return \ArrayIterator
154
+	 */
155
+	public function getIterator()
156
+	{
157
+		return new \ArrayIterator($this->_claims);
158
+	}
159 159
     
160
-    /**
161
-     * Convert to string.
162
-     *
163
-     * @return string
164
-     */
165
-    public function __toString()
166
-    {
167
-        return $this->toJSON();
168
-    }
160
+	/**
161
+	 * Convert to string.
162
+	 *
163
+	 * @return string
164
+	 */
165
+	public function __toString()
166
+	{
167
+		return $this->toJSON();
168
+	}
169 169
 }
Please login to merge, or discard this patch.
lib/JWX/Util/UUIDv4.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -28,32 +28,32 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class UUIDv4
30 30
 {
31
-    /**
32
-     * UUID.
33
-     *
34
-     * @var string $_uuid
35
-     */
36
-    protected $_uuid;
31
+	/**
32
+	 * UUID.
33
+	 *
34
+	 * @var string $_uuid
35
+	 */
36
+	protected $_uuid;
37 37
     
38
-    /**
39
-     * Constructor.
40
-     *
41
-     * @param string $uuid UUIDv4 in canonical hexadecimal format
42
-     */
43
-    public function __construct($uuid)
44
-    {
45
-        // @todo Check that UUID is version 4
46
-        $this->_uuid = $uuid;
47
-    }
38
+	/**
39
+	 * Constructor.
40
+	 *
41
+	 * @param string $uuid UUIDv4 in canonical hexadecimal format
42
+	 */
43
+	public function __construct($uuid)
44
+	{
45
+		// @todo Check that UUID is version 4
46
+		$this->_uuid = $uuid;
47
+	}
48 48
     
49
-    /**
50
-     * Create new random UUIDv4.
51
-     *
52
-     * @return self
53
-     */
54
-    public static function createRandom()
55
-    {
56
-        /*
49
+	/**
50
+	 * Create new random UUIDv4.
51
+	 *
52
+	 * @return self
53
+	 */
54
+	public static function createRandom()
55
+	{
56
+		/*
57 57
          1. Set the two most significant bits (bits 6 and 7) of
58 58
          the clock_seq_hi_and_reserved to zero and one, respectively.
59 59
          
@@ -64,38 +64,38 @@  discard block
 block discarded – undo
64 64
          3. Set all the other bits to randomly (or pseudo-randomly)
65 65
          chosen values.
66 66
          */
67
-        $uuid = sprintf("%04x%04x-%04x-%04x-%02x%02x-%04x%04x%04x",
68
-            // time_low
69
-            mt_rand(0, 0xffff), mt_rand(0, 0xffff), 
70
-            // time_mid
71
-            mt_rand(0, 0xffff), 
72
-            // time_hi_and_version
73
-            mt_rand(0, 0x0fff) | 0x4000, 
74
-            // clk_seq_hi_res
75
-            mt_rand(0, 0x3f) | 0x80, 
76
-            // clk_seq_low
77
-            mt_rand(0, 0xff), 
78
-            // node
79
-            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
80
-        return new self($uuid);
81
-    }
67
+		$uuid = sprintf("%04x%04x-%04x-%04x-%02x%02x-%04x%04x%04x",
68
+			// time_low
69
+			mt_rand(0, 0xffff), mt_rand(0, 0xffff), 
70
+			// time_mid
71
+			mt_rand(0, 0xffff), 
72
+			// time_hi_and_version
73
+			mt_rand(0, 0x0fff) | 0x4000, 
74
+			// clk_seq_hi_res
75
+			mt_rand(0, 0x3f) | 0x80, 
76
+			// clk_seq_low
77
+			mt_rand(0, 0xff), 
78
+			// node
79
+			mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
80
+		return new self($uuid);
81
+	}
82 82
     
83
-    /**
84
-     * Get UUIDv4 in canonical form.
85
-     *
86
-     * @return string
87
-     */
88
-    public function canonical()
89
-    {
90
-        return $this->_uuid;
91
-    }
83
+	/**
84
+	 * Get UUIDv4 in canonical form.
85
+	 *
86
+	 * @return string
87
+	 */
88
+	public function canonical()
89
+	{
90
+		return $this->_uuid;
91
+	}
92 92
     
93
-    /**
94
-     *
95
-     * @return string
96
-     */
97
-    public function __toString()
98
-    {
99
-        return $this->canonical();
100
-    }
93
+	/**
94
+	 *
95
+	 * @return string
96
+	 */
97
+	public function __toString()
98
+	{
99
+		return $this->canonical();
100
+	}
101 101
 }
Please login to merge, or discard this patch.
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.
lib/JWX/Util/Base64.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -7,104 +7,104 @@
 block discarded – undo
7 7
  */
8 8
 class Base64
9 9
 {
10
-    /**
11
-     * Encode a string using base64url variant.
12
-     *
13
-     * @link https://en.wikipedia.org/wiki/Base64#URL_applications
14
-     * @param string $data
15
-     * @return string
16
-     */
17
-    public static function urlEncode($data)
18
-    {
19
-        return strtr(rtrim(self::encode($data), "="), "+/", "-_");
20
-    }
10
+	/**
11
+	 * Encode a string using base64url variant.
12
+	 *
13
+	 * @link https://en.wikipedia.org/wiki/Base64#URL_applications
14
+	 * @param string $data
15
+	 * @return string
16
+	 */
17
+	public static function urlEncode($data)
18
+	{
19
+		return strtr(rtrim(self::encode($data), "="), "+/", "-_");
20
+	}
21 21
     
22
-    /**
23
-     * Decode a string using base64url variant.
24
-     *
25
-     * @link https://en.wikipedia.org/wiki/Base64#URL_applications
26
-     * @param string $data
27
-     * @throws \UnexpectedValueException
28
-     * @return string
29
-     */
30
-    public static function urlDecode($data)
31
-    {
32
-        $data = strtr($data, "-_", "+/");
33
-        switch (strlen($data) % 4) {
34
-            case 0:
35
-                break;
36
-            case 2:
37
-                $data .= "==";
38
-                break;
39
-            case 3:
40
-                $data .= "=";
41
-                break;
42
-            default:
43
-                throw new \UnexpectedValueException(
44
-                    "Malformed base64url encoding.");
45
-        }
46
-        return self::decode($data);
47
-    }
22
+	/**
23
+	 * Decode a string using base64url variant.
24
+	 *
25
+	 * @link https://en.wikipedia.org/wiki/Base64#URL_applications
26
+	 * @param string $data
27
+	 * @throws \UnexpectedValueException
28
+	 * @return string
29
+	 */
30
+	public static function urlDecode($data)
31
+	{
32
+		$data = strtr($data, "-_", "+/");
33
+		switch (strlen($data) % 4) {
34
+			case 0:
35
+				break;
36
+			case 2:
37
+				$data .= "==";
38
+				break;
39
+			case 3:
40
+				$data .= "=";
41
+				break;
42
+			default:
43
+				throw new \UnexpectedValueException(
44
+					"Malformed base64url encoding.");
45
+		}
46
+		return self::decode($data);
47
+	}
48 48
     
49
-    /**
50
-     * Check whether string is validly base64url encoded.
51
-     *
52
-     * @link https://en.wikipedia.org/wiki/Base64#URL_applications
53
-     * @param string $data
54
-     * @return bool
55
-     */
56
-    public static function isValidURLEncoding($data)
57
-    {
58
-        return preg_match('#^[A-Za-z0-9\-_]*$#', $data) == 1;
59
-    }
49
+	/**
50
+	 * Check whether string is validly base64url encoded.
51
+	 *
52
+	 * @link https://en.wikipedia.org/wiki/Base64#URL_applications
53
+	 * @param string $data
54
+	 * @return bool
55
+	 */
56
+	public static function isValidURLEncoding($data)
57
+	{
58
+		return preg_match('#^[A-Za-z0-9\-_]*$#', $data) == 1;
59
+	}
60 60
     
61
-    /**
62
-     * Encode a string in base64.
63
-     *
64
-     * @link https://tools.ietf.org/html/rfc4648#section-4
65
-     * @param string $data
66
-     * @throws \RuntimeException If encoding fails
67
-     * @return string
68
-     */
69
-    public static function encode($data)
70
-    {
71
-        $ret = @base64_encode($data);
72
-        if (!is_string($ret)) {
73
-            $err = error_get_last();
74
-            $msg = isset($err) ? $err["message"] : "base64_encode() failed.";
75
-            throw new \RuntimeException($msg);
76
-        }
77
-        return $ret;
78
-    }
61
+	/**
62
+	 * Encode a string in base64.
63
+	 *
64
+	 * @link https://tools.ietf.org/html/rfc4648#section-4
65
+	 * @param string $data
66
+	 * @throws \RuntimeException If encoding fails
67
+	 * @return string
68
+	 */
69
+	public static function encode($data)
70
+	{
71
+		$ret = @base64_encode($data);
72
+		if (!is_string($ret)) {
73
+			$err = error_get_last();
74
+			$msg = isset($err) ? $err["message"] : "base64_encode() failed.";
75
+			throw new \RuntimeException($msg);
76
+		}
77
+		return $ret;
78
+	}
79 79
     
80
-    /**
81
-     * Decode a string from base64 encoding.
82
-     *
83
-     * @link https://tools.ietf.org/html/rfc4648#section-4
84
-     * @param string $data
85
-     * @throws \RuntimeException If decoding fails
86
-     * @return string
87
-     */
88
-    public static function decode($data)
89
-    {
90
-        $ret = base64_decode($data, true);
91
-        if (!is_string($ret)) {
92
-            $err = error_get_last();
93
-            $msg = isset($err) ? $err["message"] : "base64_decode() failed.";
94
-            throw new \RuntimeException($msg);
95
-        }
96
-        return $ret;
97
-    }
80
+	/**
81
+	 * Decode a string from base64 encoding.
82
+	 *
83
+	 * @link https://tools.ietf.org/html/rfc4648#section-4
84
+	 * @param string $data
85
+	 * @throws \RuntimeException If decoding fails
86
+	 * @return string
87
+	 */
88
+	public static function decode($data)
89
+	{
90
+		$ret = base64_decode($data, true);
91
+		if (!is_string($ret)) {
92
+			$err = error_get_last();
93
+			$msg = isset($err) ? $err["message"] : "base64_decode() failed.";
94
+			throw new \RuntimeException($msg);
95
+		}
96
+		return $ret;
97
+	}
98 98
     
99
-    /**
100
-     * Check whether string is validly base64 encoded.
101
-     *
102
-     * @link https://tools.ietf.org/html/rfc4648#section-4
103
-     * @param string $data
104
-     * @return bool
105
-     */
106
-    public static function isValid($data)
107
-    {
108
-        return preg_match('#^[A-Za-z0-9+/]*={0,2}$#', $data) == 1;
109
-    }
99
+	/**
100
+	 * Check whether string is validly base64 encoded.
101
+	 *
102
+	 * @link https://tools.ietf.org/html/rfc4648#section-4
103
+	 * @param string $data
104
+	 * @return bool
105
+	 */
106
+	public static function isValid($data)
107
+	{
108
+		return preg_match('#^[A-Za-z0-9+/]*={0,2}$#', $data) == 1;
109
+	}
110 110
 }
Please login to merge, or discard this patch.
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@
 block discarded – undo
31 31
     {
32 32
         $data = strtr($data, "-_", "+/");
33 33
         switch (strlen($data) % 4) {
34
-            case 0:
35
-                break;
36
-            case 2:
37
-                $data .= "==";
38
-                break;
39
-            case 3:
40
-                $data .= "=";
41
-                break;
42
-            default:
43
-                throw new \UnexpectedValueException(
44
-                    "Malformed base64url encoding.");
34
+        case 0:
35
+            break;
36
+        case 2:
37
+            $data .= "==";
38
+            break;
39
+        case 3:
40
+            $data .= "=";
41
+            break;
42
+        default:
43
+            throw new \UnexpectedValueException(
44
+                "Malformed base64url encoding.");
45 45
         }
46 46
         return self::decode($data);
47 47
     }
Please login to merge, or discard this patch.