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 ( 90b318...149c7a )
by Joni
04:00
created

TypedHeader   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 60
ccs 6
cts 14
cp 0.4286
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
has() 0 1 ?
get() 0 1 ?
A hasAlgorithm() 0 3 1
A algorithm() 0 7 2
A hasAuthenticationTag() 0 3 1
A authenticationTag() 0 7 2
1
<?php
2
3
namespace JWX\JWT\Header;
4
5
use JWX\JWT\Parameter\AlgorithmParameter;
6
use JWX\JWT\Parameter\AuthenticationTagParameter;
7
use JWX\JWT\Parameter\RegisteredJWTParameter;
8
9
10
trait TypedHeader
11
{
12
	/**
13
	 * Whether parameters are present.
14
	 *
15
	 * @param string ...$names Parameter names
16
	 * @return bool
17
	 */
18
	abstract public function has(...$names);
19
	
20
	/**
21
	 * Get a parameter.
22
	 *
23
	 * @param string $name Parameter name
24
	 * @return JWTParameter
25
	 */
26
	abstract public function get($name);
27
	
28
	/**
29
	 *
30
	 * @return bool
31
	 */
32
	public function hasAlgorithm() {
33
		return $this->has(RegisteredJWTParameter::P_ALG);
34
	}
35
	
36
	/**
37
	 *
38
	 * @throws \UnexpectedValueException
39
	 * @return AlgorithmParameter
40
	 */
41
	public function algorithm() {
42
		$param = $this->get(RegisteredJWTParameter::P_ALG);
43
		if (!$param instanceof AlgorithmParameter) {
44
			throw new \UnexpectedValueException();
45
		}
46
		return $param;
47
	}
48
	
49
	/**
50
	 *
51
	 * @return bool
52
	 */
53 5
	public function hasAuthenticationTag() {
54 5
		return $this->has(RegisteredJWTParameter::P_TAG);
55
	}
56
	
57
	/**
58
	 *
59
	 * @throws \UnexpectedValueException
60
	 * @return AuthenticationTagParameter
61
	 */
62 4
	public function authenticationTag() {
63 4
		$param = $this->get(RegisteredJWTParameter::P_TAG);
64 4
		if (!$param instanceof AuthenticationTagParameter) {
65
			throw new \UnexpectedValueException();
66
		}
67 4
		return $param;
68
	}
69
}
70