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

ArrayParameterValue::fromJSONValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
namespace JWX\Parameter\Feature;
4
5
6
/**
7
 * Trait for parameters having an array value.
8
 */
9
trait ArrayParameterValue
10
{
11
	/**
12
	 * Constructor.
13
	 *
14
	 * @param mixed ...$values
15
	 */
16
	abstract public function __construct(...$values);
17
	
18
	/**
19
	 * Initialize from a JSON value.
20
	 *
21
	 * @param array $value
22
	 * @return static
23
	 */
24 5
	public static function fromJSONValue($value) {
25 5
		if (!is_array($value)) {
26 2
			throw new \UnexpectedValueException(
27 2
				get_called_class() . " expects an array parameter.");
28
		}
29 3
		return new static(...$value);
30
	}
31
}
32