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 ( 62af7f...70b15e )
by Joni
04:01
created

SignatureAlgorithm::fromJWK()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace JWX\JWS;
4
5
use JWX\JWK\JWK;
6
use JWX\JWS\Algorithm\SignatureAlgorithmFactory;
7
use JWX\JWT\Header\Header;
8
use JWX\JWT\Header\HeaderParameters;
9
use JWX\JWT\Parameter\AlgorithmParameterValue;
10
11
12
/**
13
 * Base class for algorithms usable for signing and validating JWS's.
14
 */
15
abstract class SignatureAlgorithm implements 
16
	AlgorithmParameterValue, 
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces before interface name; 1 found
Loading history...
17
	HeaderParameters
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces before interface name; 1 found
Loading history...
18
{
19
	/**
20
	 * Compute signature.
21
	 *
22
	 * @param string $data Data for which the signature is computed
23
	 * @return string
24
	 */
25
	abstract public function computeSignature($data);
26
	
27
	/**
28
	 * Validate signature.
29
	 *
30
	 * @param string $data Data to validate
31
	 * @param string $signature Signature to compare
32
	 * @return bool
33
	 */
34
	abstract public function validateSignature($data, $signature);
35
	
36
	/**
37
	 * Initialize signature algorithm from a JWK and a header.
38
	 *
39
	 * @param JWK $jwk JSON Web Key
40
	 * @param Header $header Header
41
	 * @return SignatureAlgorithm
42
	 */
43 2
	public static function fromJWK(JWK $jwk, Header $header) {
44 2
		$factory = new SignatureAlgorithmFactory($header);
45 2
		return $factory->algoByKey($jwk);
46
	}
47
}
48