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 ( eef5cb...fe4976 )
by Joni
06:29
created

PathValidationResult   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 1
cbo 1
dl 0
loc 77
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A certificate() 0 3 1
A policies() 0 6 2
1
<?php
2
3
namespace X509\CertificationPath\PathValidation;
4
5
use ASN1\Element;
6
use CryptoUtil\ASN1\AlgorithmIdentifier\Feature\AlgorithmIdentifierType;
7
use CryptoUtil\ASN1\PublicKeyInfo;
8
use X509\Certificate\Certificate;
9
use X509\Certificate\Extension\CertificatePolicy\PolicyInformation;
10
use X509\CertificationPath\Policy\PolicyTree;
11
12
13
/**
14
 * Result of the path validation process.
15
 *
16
 * @link https://tools.ietf.org/html/rfc5280#section-6.1.6
17
 */
18
class PathValidationResult
19
{
20
	/**
21
	 * Certificates in a certification path.
22
	 *
23
	 * @var Certificate[] $_certificates
24
	 */
25
	protected $_certificates;
26
	
27
	/**
28
	 * Valid policy tree.
29
	 *
30
	 * @var PolicyTree|null $_policyTree
31
	 */
32
	protected $_policyTree;
33
	
34
	/**
35
	 * End-entity certificate's public key.
36
	 *
37
	 * @var PublicKeyInfo
38
	 */
39
	protected $_publicKeyInfo;
40
	
41
	/**
42
	 * Public key algorithm.
43
	 *
44
	 * @var AlgorithmIdentifierType
45
	 */
46
	protected $_publicKeyAlgo;
47
	
48
	/**
49
	 * Public key parameters.
50
	 *
51
	 * @var Element|null $_publicKeyParameters
52
	 */
53
	protected $_publicKeyParameters;
54
	
55
	/**
56
	 * Constructor
57
	 *
58
	 * @param array $certificates
59
	 * @param PolicyTree|null $policy_tree
60
	 * @param PublicKeyInfo $pubkey_info
61
	 * @param AlgorithmIdentifierType $algo
62
	 * @param Element|null $params
63
	 */
64 28
	public function __construct(array $certificates, $policy_tree, 
65
			PublicKeyInfo $pubkey_info, AlgorithmIdentifierType $algo, 
66
			Element $params = null) {
67 28
		$this->_certificates = array_values($certificates);
0 ignored issues
show
Documentation Bug introduced by
It seems like array_values($certificates) of type array<integer,?> is incompatible with the declared type array<integer,object<X50...rtificate\Certificate>> of property $_certificates.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
68 28
		$this->_policyTree = $policy_tree;
69 28
		$this->_publicKeyInfo = $pubkey_info;
70 28
		$this->_publicKeyAlgo = $algo;
71 28
		$this->_publicKeyParameters = $params;
72 28
	}
73
	
74
	/**
75
	 * Get end-entity certificate.
76
	 *
77
	 * @return Certificate
78
	 */
79 12
	public function certificate() {
80 12
		return $this->_certificates[count($this->_certificates) - 1];
81
	}
82
	
83
	/**
84
	 * Get certificate policies of the end-entity certificate.
85
	 *
86
	 * @return PolicyInformation[]
87
	 */
88 6
	public function policies() {
89 6
		if (!$this->_policyTree) {
90 1
			return array();
91
		}
92 5
		return $this->_policyTree->policiesAtDepth(count($this->_certificates));
93
	}
94
}
95