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 ( ce507f...5e3b1d )
by Joni
04:09
created

Base64URLValue::string()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace JWX\Parameter\Feature;
4
5
use JWX\Util\Base64;
6
7
8
/**
9
 * Trait for parameters having Base64url value.
10
 */
11
trait Base64URLValue
12
{
13
	use StringParameterValue;
14
	
15
	/**
16
	 * Get the parameter value.
17
	 *
18
	 * @return string
19
	 */
20
	abstract public function value();
21
	
22
	/**
23
	 * Initialize from native value.
24
	 *
25
	 * Value shall be encoded using Base64url encoding.
26
	 *
27
	 * @param string $value
28
	 * @return self
29
	 */
30 86
	public static function fromString($value) {
31 86
		return new static(Base64::urlEncode($value));
32
	}
33
	
34
	/**
35
	 * Validate that value is validly base64url encoded.
36
	 *
37
	 * @param string $value
38
	 * @throws \UnexpectedValueException
39
	 * @return self
40
	 */
41 124
	protected function _validateEncoding($value) {
42 124
		if (!Base64::isValidURLEncoding($value)) {
43 1
			throw new \UnexpectedValueException(
44 1
				"Value must be base64url encoded.");
45
		}
46 123
		return $this;
47
	}
48
	
49
	/**
50
	 * Get the parameter value as a decoded string.
51
	 *
52
	 * @return string
53
	 */
54 32
	public function string() {
55 32
		return Base64::urlDecode($this->value());
56
	}
57
}
58