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::get()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
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