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 ( 11b52a...ce507f )
by Joni
04:03
created

CriticalParameter::fromJSONValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace JWX\JWT\Parameter;
4
5
use JWX\Parameter\Feature\ArrayParameterValue;
6
7
8
/**
9
 * Implements 'Critical' parameter.
10
 *
11
 * @link https://tools.ietf.org/html/rfc7515#section-4.1.11
12
 */
13
class CriticalParameter extends JWTParameter
14
{
15
	use ArrayParameterValue;
16
	
17
	/**
18
	 * Constructor
19
	 *
20
	 * @param string ...$names
21
	 */
22 7
	public function __construct(...$names) {
23 7
		parent::__construct(self::PARAM_CRITICAL, $names);
24 7
	}
25
	
26
	/**
27
	 * Get self with parameter name added.
28
	 *
29
	 * @param string $name
30
	 * @return self
31
	 */
32 3
	public function withParamName($name) {
33 3
		$obj = clone $this;
34 3
		$obj->_value[] = $name;
35 3
		$obj->_value = array_values(array_unique($obj->_value));
36 3
		return $obj;
37
	}
38
	
39
	/**
40
	 * Check whether given parameter name is critical.
41
	 *
42
	 * @param string $name
43
	 * @return bool
44
	 */
45 2
	public function has($name) {
46 2
		return false !== array_search($name, $this->_value);
47
	}
48
	
49
	/**
50
	 * Get critical header parameter names.
51
	 *
52
	 * @return string[]
53
	 */
54 3
	public function names() {
55 3
		return $this->_value;
56
	}
57
}
58