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.
Test Failed
Pull Request — master (#1)
by thomas
05:34
created
lib/X509/Certificate/Extension/DistributionPoint/DistributionPoint.php 2 patches
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -18,215 +18,215 @@
 block discarded – undo
18 18
  */
19 19
 class DistributionPoint
20 20
 {
21
-    /**
22
-     * Distribution point name.
23
-     *
24
-     * @var DistributionPointName $_distributionPoint
25
-     */
26
-    protected $_distributionPoint;
21
+	/**
22
+	 * Distribution point name.
23
+	 *
24
+	 * @var DistributionPointName $_distributionPoint
25
+	 */
26
+	protected $_distributionPoint;
27 27
     
28
-    /**
29
-     * Revocation reason.
30
-     *
31
-     * @var ReasonFlags $_reasons
32
-     */
33
-    protected $_reasons;
28
+	/**
29
+	 * Revocation reason.
30
+	 *
31
+	 * @var ReasonFlags $_reasons
32
+	 */
33
+	protected $_reasons;
34 34
     
35
-    /**
36
-     * CRL issuer.
37
-     *
38
-     * @var GeneralNames $_issuer
39
-     */
40
-    protected $_issuer;
35
+	/**
36
+	 * CRL issuer.
37
+	 *
38
+	 * @var GeneralNames $_issuer
39
+	 */
40
+	protected $_issuer;
41 41
     
42
-    /**
43
-     * Constructor.
44
-     *
45
-     * @param DistributionPointName $name
46
-     * @param ReasonFlags $reasons
47
-     * @param GeneralNames $issuer
48
-     */
49
-    public function __construct(DistributionPointName $name = null,
50
-        ReasonFlags $reasons = null, GeneralNames $issuer = null)
51
-    {
52
-        $this->_distributionPoint = $name;
53
-        $this->_reasons = $reasons;
54
-        $this->_issuer = $issuer;
55
-    }
42
+	/**
43
+	 * Constructor.
44
+	 *
45
+	 * @param DistributionPointName $name
46
+	 * @param ReasonFlags $reasons
47
+	 * @param GeneralNames $issuer
48
+	 */
49
+	public function __construct(DistributionPointName $name = null,
50
+		ReasonFlags $reasons = null, GeneralNames $issuer = null)
51
+	{
52
+		$this->_distributionPoint = $name;
53
+		$this->_reasons = $reasons;
54
+		$this->_issuer = $issuer;
55
+	}
56 56
     
57
-    /**
58
-     * Initialize from ASN.1.
59
-     *
60
-     * @param Sequence $seq
61
-     * @return self
62
-     */
63
-    public static function fromASN1(Sequence $seq)
64
-    {
65
-        $name = null;
66
-        $reasons = null;
67
-        $issuer = null;
68
-        if ($seq->hasTagged(0)) {
69
-            // promoted to explicit tagging because underlying type is CHOICE
70
-            $name = DistributionPointName::fromTaggedType(
71
-                $seq->getTagged(0)
72
-                    ->asExplicit()
73
-                    ->asTagged());
74
-        }
75
-        if ($seq->hasTagged(1)) {
76
-            $reasons = ReasonFlags::fromASN1(
77
-                $seq->getTagged(1)
78
-                    ->asImplicit(Element::TYPE_BIT_STRING)
79
-                    ->asBitString());
80
-        }
81
-        if ($seq->hasTagged(2)) {
82
-            $issuer = GeneralNames::fromASN1(
83
-                $seq->getTagged(2)
84
-                    ->asImplicit(Element::TYPE_SEQUENCE)
85
-                    ->asSequence());
86
-        }
87
-        return new self($name, $reasons, $issuer);
88
-    }
57
+	/**
58
+	 * Initialize from ASN.1.
59
+	 *
60
+	 * @param Sequence $seq
61
+	 * @return self
62
+	 */
63
+	public static function fromASN1(Sequence $seq)
64
+	{
65
+		$name = null;
66
+		$reasons = null;
67
+		$issuer = null;
68
+		if ($seq->hasTagged(0)) {
69
+			// promoted to explicit tagging because underlying type is CHOICE
70
+			$name = DistributionPointName::fromTaggedType(
71
+				$seq->getTagged(0)
72
+					->asExplicit()
73
+					->asTagged());
74
+		}
75
+		if ($seq->hasTagged(1)) {
76
+			$reasons = ReasonFlags::fromASN1(
77
+				$seq->getTagged(1)
78
+					->asImplicit(Element::TYPE_BIT_STRING)
79
+					->asBitString());
80
+		}
81
+		if ($seq->hasTagged(2)) {
82
+			$issuer = GeneralNames::fromASN1(
83
+				$seq->getTagged(2)
84
+					->asImplicit(Element::TYPE_SEQUENCE)
85
+					->asSequence());
86
+		}
87
+		return new self($name, $reasons, $issuer);
88
+	}
89 89
     
90
-    /**
91
-     * Check whether distribution point name is set.
92
-     *
93
-     * @return bool
94
-     */
95
-    public function hasDistributionPointName(): bool
96
-    {
97
-        return isset($this->_distributionPoint);
98
-    }
90
+	/**
91
+	 * Check whether distribution point name is set.
92
+	 *
93
+	 * @return bool
94
+	 */
95
+	public function hasDistributionPointName(): bool
96
+	{
97
+		return isset($this->_distributionPoint);
98
+	}
99 99
     
100
-    /**
101
-     * Get distribution point name.
102
-     *
103
-     * @throws \LogicException
104
-     * @return DistributionPointName
105
-     */
106
-    public function distributionPointName(): DistributionPointName
107
-    {
108
-        if (!$this->hasDistributionPointName()) {
109
-            throw new \LogicException("distributionPoint not set.");
110
-        }
111
-        return $this->_distributionPoint;
112
-    }
100
+	/**
101
+	 * Get distribution point name.
102
+	 *
103
+	 * @throws \LogicException
104
+	 * @return DistributionPointName
105
+	 */
106
+	public function distributionPointName(): DistributionPointName
107
+	{
108
+		if (!$this->hasDistributionPointName()) {
109
+			throw new \LogicException("distributionPoint not set.");
110
+		}
111
+		return $this->_distributionPoint;
112
+	}
113 113
     
114
-    /**
115
-     * Check whether distribution point name is set and it's a full name.
116
-     *
117
-     * @return bool
118
-     */
119
-    public function hasFullName(): bool
120
-    {
121
-        return $this->distributionPointName()->tag() ==
122
-             DistributionPointName::TAG_FULL_NAME;
123
-    }
114
+	/**
115
+	 * Check whether distribution point name is set and it's a full name.
116
+	 *
117
+	 * @return bool
118
+	 */
119
+	public function hasFullName(): bool
120
+	{
121
+		return $this->distributionPointName()->tag() ==
122
+			 DistributionPointName::TAG_FULL_NAME;
123
+	}
124 124
     
125
-    /**
126
-     * Get full distribution point name.
127
-     *
128
-     * @throws \LogicException
129
-     * @return FullName
130
-     */
131
-    public function fullName(): FullName
132
-    {
133
-        if (!$this->hasFullName()) {
134
-            throw new \LogicException("fullName not set.");
135
-        }
136
-        return $this->_distributionPoint;
137
-    }
125
+	/**
126
+	 * Get full distribution point name.
127
+	 *
128
+	 * @throws \LogicException
129
+	 * @return FullName
130
+	 */
131
+	public function fullName(): FullName
132
+	{
133
+		if (!$this->hasFullName()) {
134
+			throw new \LogicException("fullName not set.");
135
+		}
136
+		return $this->_distributionPoint;
137
+	}
138 138
     
139
-    /**
140
-     * Check whether distribution point name is set and it's a relative name.
141
-     *
142
-     * @return bool
143
-     */
144
-    public function hasRelativeName(): bool
145
-    {
146
-        return $this->distributionPointName()->tag() ==
147
-             DistributionPointName::TAG_RDN;
148
-    }
139
+	/**
140
+	 * Check whether distribution point name is set and it's a relative name.
141
+	 *
142
+	 * @return bool
143
+	 */
144
+	public function hasRelativeName(): bool
145
+	{
146
+		return $this->distributionPointName()->tag() ==
147
+			 DistributionPointName::TAG_RDN;
148
+	}
149 149
     
150
-    /**
151
-     * Get relative distribution point name.
152
-     *
153
-     * @throws \LogicException
154
-     * @return RelativeName
155
-     */
156
-    public function relativeName(): RelativeName
157
-    {
158
-        if (!$this->hasRelativeName()) {
159
-            throw new \LogicException("nameRelativeToCRLIssuer not set.");
160
-        }
161
-        return $this->_distributionPoint;
162
-    }
150
+	/**
151
+	 * Get relative distribution point name.
152
+	 *
153
+	 * @throws \LogicException
154
+	 * @return RelativeName
155
+	 */
156
+	public function relativeName(): RelativeName
157
+	{
158
+		if (!$this->hasRelativeName()) {
159
+			throw new \LogicException("nameRelativeToCRLIssuer not set.");
160
+		}
161
+		return $this->_distributionPoint;
162
+	}
163 163
     
164
-    /**
165
-     * Check whether reasons flags is set.
166
-     *
167
-     * @return bool
168
-     */
169
-    public function hasReasons(): bool
170
-    {
171
-        return isset($this->_reasons);
172
-    }
164
+	/**
165
+	 * Check whether reasons flags is set.
166
+	 *
167
+	 * @return bool
168
+	 */
169
+	public function hasReasons(): bool
170
+	{
171
+		return isset($this->_reasons);
172
+	}
173 173
     
174
-    /**
175
-     * Get revocation reason flags.
176
-     *
177
-     * @throws \LogicException
178
-     * @return ReasonFlags
179
-     */
180
-    public function reasons(): ReasonFlags
181
-    {
182
-        if (!$this->hasReasons()) {
183
-            throw new \LogicException("reasons not set.");
184
-        }
185
-        return $this->_reasons;
186
-    }
174
+	/**
175
+	 * Get revocation reason flags.
176
+	 *
177
+	 * @throws \LogicException
178
+	 * @return ReasonFlags
179
+	 */
180
+	public function reasons(): ReasonFlags
181
+	{
182
+		if (!$this->hasReasons()) {
183
+			throw new \LogicException("reasons not set.");
184
+		}
185
+		return $this->_reasons;
186
+	}
187 187
     
188
-    /**
189
-     * Check whether cRLIssuer is set.
190
-     *
191
-     * @return bool
192
-     */
193
-    public function hasCRLIssuer(): bool
194
-    {
195
-        return isset($this->_issuer);
196
-    }
188
+	/**
189
+	 * Check whether cRLIssuer is set.
190
+	 *
191
+	 * @return bool
192
+	 */
193
+	public function hasCRLIssuer(): bool
194
+	{
195
+		return isset($this->_issuer);
196
+	}
197 197
     
198
-    /**
199
-     * Get CRL issuer.
200
-     *
201
-     * @throws \LogicException
202
-     * @return GeneralNames
203
-     */
204
-    public function crlIssuer(): GeneralNames
205
-    {
206
-        if (!$this->hasCRLIssuer()) {
207
-            throw new \LogicException("crlIssuer not set.");
208
-        }
209
-        return $this->_issuer;
210
-    }
198
+	/**
199
+	 * Get CRL issuer.
200
+	 *
201
+	 * @throws \LogicException
202
+	 * @return GeneralNames
203
+	 */
204
+	public function crlIssuer(): GeneralNames
205
+	{
206
+		if (!$this->hasCRLIssuer()) {
207
+			throw new \LogicException("crlIssuer not set.");
208
+		}
209
+		return $this->_issuer;
210
+	}
211 211
     
212
-    /**
213
-     * Generate ASN.1 structure.
214
-     *
215
-     * @return Sequence
216
-     */
217
-    public function toASN1(): Sequence
218
-    {
219
-        $elements = array();
220
-        if (isset($this->_distributionPoint)) {
221
-            $elements[] = new ExplicitlyTaggedType(0,
222
-                $this->_distributionPoint->toASN1());
223
-        }
224
-        if (isset($this->_reasons)) {
225
-            $elements[] = new ImplicitlyTaggedType(1, $this->_reasons->toASN1());
226
-        }
227
-        if (isset($this->_issuer)) {
228
-            $elements[] = new ImplicitlyTaggedType(2, $this->_issuer->toASN1());
229
-        }
230
-        return new Sequence(...$elements);
231
-    }
212
+	/**
213
+	 * Generate ASN.1 structure.
214
+	 *
215
+	 * @return Sequence
216
+	 */
217
+	public function toASN1(): Sequence
218
+	{
219
+		$elements = array();
220
+		if (isset($this->_distributionPoint)) {
221
+			$elements[] = new ExplicitlyTaggedType(0,
222
+				$this->_distributionPoint->toASN1());
223
+		}
224
+		if (isset($this->_reasons)) {
225
+			$elements[] = new ImplicitlyTaggedType(1, $this->_reasons->toASN1());
226
+		}
227
+		if (isset($this->_issuer)) {
228
+			$elements[] = new ImplicitlyTaggedType(2, $this->_issuer->toASN1());
229
+		}
230
+		return new Sequence(...$elements);
231
+	}
232 232
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension\DistributionPoint;
6 6
 
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/DistributionPoint/DistributionPointName.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -18,64 +18,64 @@
 block discarded – undo
18 18
  */
19 19
 abstract class DistributionPointName
20 20
 {
21
-    const TAG_FULL_NAME = 0;
22
-    const TAG_RDN = 1;
21
+	const TAG_FULL_NAME = 0;
22
+	const TAG_RDN = 1;
23 23
     
24
-    /**
25
-     * Type.
26
-     *
27
-     * @var int $_tag
28
-     */
29
-    protected $_tag;
24
+	/**
25
+	 * Type.
26
+	 *
27
+	 * @var int $_tag
28
+	 */
29
+	protected $_tag;
30 30
     
31
-    /**
32
-     * Generate ASN.1 element.
33
-     *
34
-     * @return Element
35
-     */
36
-    abstract protected function _valueASN1();
31
+	/**
32
+	 * Generate ASN.1 element.
33
+	 *
34
+	 * @return Element
35
+	 */
36
+	abstract protected function _valueASN1();
37 37
     
38
-    /**
39
-     * Initialize from TaggedType.
40
-     *
41
-     * @param TaggedType $el
42
-     * @throws \UnexpectedValueException
43
-     * @return self
44
-     */
45
-    public static function fromTaggedType(TaggedType $el)
46
-    {
47
-        switch ($el->tag()) {
48
-            case self::TAG_FULL_NAME:
49
-                return new FullName(
50
-                    GeneralNames::fromASN1(
51
-                        $el->asImplicit(Element::TYPE_SEQUENCE)->asSequence()));
52
-            case self::TAG_RDN:
53
-                return new RelativeName(
54
-                    RDN::fromASN1($el->asImplicit(Element::TYPE_SET)->asSet()));
55
-            default:
56
-                throw new \UnexpectedValueException(
57
-                    "DistributionPointName tag " . $el->tag() . " not supported.");
58
-        }
59
-    }
38
+	/**
39
+	 * Initialize from TaggedType.
40
+	 *
41
+	 * @param TaggedType $el
42
+	 * @throws \UnexpectedValueException
43
+	 * @return self
44
+	 */
45
+	public static function fromTaggedType(TaggedType $el)
46
+	{
47
+		switch ($el->tag()) {
48
+			case self::TAG_FULL_NAME:
49
+				return new FullName(
50
+					GeneralNames::fromASN1(
51
+						$el->asImplicit(Element::TYPE_SEQUENCE)->asSequence()));
52
+			case self::TAG_RDN:
53
+				return new RelativeName(
54
+					RDN::fromASN1($el->asImplicit(Element::TYPE_SET)->asSet()));
55
+			default:
56
+				throw new \UnexpectedValueException(
57
+					"DistributionPointName tag " . $el->tag() . " not supported.");
58
+		}
59
+	}
60 60
     
61
-    /**
62
-     * Get type tag.
63
-     *
64
-     * @return int
65
-     */
66
-    public function tag()
67
-    {
68
-        return $this->_tag;
69
-    }
61
+	/**
62
+	 * Get type tag.
63
+	 *
64
+	 * @return int
65
+	 */
66
+	public function tag()
67
+	{
68
+		return $this->_tag;
69
+	}
70 70
     
71
-    /**
72
-     * Generate ASN.1 structure.
73
-     *
74
-     * @return ImplicitlyTaggedType
75
-     */
76
-    public function toASN1(): ImplicitlyTaggedType
77
-    {
78
-        $element = $this->_valueASN1();
79
-        return new ImplicitlyTaggedType($this->_tag, $element);
80
-    }
71
+	/**
72
+	 * Generate ASN.1 structure.
73
+	 *
74
+	 * @return ImplicitlyTaggedType
75
+	 */
76
+	public function toASN1(): ImplicitlyTaggedType
77
+	{
78
+		$element = $this->_valueASN1();
79
+		return new ImplicitlyTaggedType($this->_tag, $element);
80
+	}
81 81
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension\DistributionPoint;
6 6
 
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/DistributionPoint/ReasonFlags.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -15,143 +15,143 @@
 block discarded – undo
15 15
  */
16 16
 class ReasonFlags
17 17
 {
18
-    // const UNUSED = 0x100;
19
-    const KEY_COMPROMISE = 0x080;
20
-    const CA_COMPROMISE = 0x040;
21
-    const AFFILIATION_CHANGED = 0x020;
22
-    const SUPERSEDED = 0x010;
23
-    const CESSATION_OF_OPERATION = 0x008;
24
-    const CERTIFICATE_HOLD = 0x004;
25
-    const PRIVILEGE_WITHDRAWN = 0x002;
26
-    const AA_COMPROMISE = 0x001;
18
+	// const UNUSED = 0x100;
19
+	const KEY_COMPROMISE = 0x080;
20
+	const CA_COMPROMISE = 0x040;
21
+	const AFFILIATION_CHANGED = 0x020;
22
+	const SUPERSEDED = 0x010;
23
+	const CESSATION_OF_OPERATION = 0x008;
24
+	const CERTIFICATE_HOLD = 0x004;
25
+	const PRIVILEGE_WITHDRAWN = 0x002;
26
+	const AA_COMPROMISE = 0x001;
27 27
     
28
-    /**
29
-     * Flags.
30
-     *
31
-     * @var int $_flags
32
-     */
33
-    protected $_flags;
28
+	/**
29
+	 * Flags.
30
+	 *
31
+	 * @var int $_flags
32
+	 */
33
+	protected $_flags;
34 34
     
35
-    /**
36
-     * Constructor.
37
-     *
38
-     * @param int $flags
39
-     */
40
-    public function __construct($flags)
41
-    {
42
-        $this->_flags = $flags;
43
-    }
35
+	/**
36
+	 * Constructor.
37
+	 *
38
+	 * @param int $flags
39
+	 */
40
+	public function __construct($flags)
41
+	{
42
+		$this->_flags = $flags;
43
+	}
44 44
     
45
-    /**
46
-     * Initialize from ASN.1.
47
-     *
48
-     * @param BitString $bs
49
-     * @return self
50
-     */
51
-    public static function fromASN1(BitString $bs)
52
-    {
53
-        return new self(Flags::fromBitString($bs, 9)->number());
54
-    }
45
+	/**
46
+	 * Initialize from ASN.1.
47
+	 *
48
+	 * @param BitString $bs
49
+	 * @return self
50
+	 */
51
+	public static function fromASN1(BitString $bs)
52
+	{
53
+		return new self(Flags::fromBitString($bs, 9)->number());
54
+	}
55 55
     
56
-    /**
57
-     * Check whether keyCompromise flag is set.
58
-     *
59
-     * @return bool
60
-     */
61
-    public function isKeyCompromise(): bool
62
-    {
63
-        return $this->_flagSet(self::KEY_COMPROMISE);
64
-    }
56
+	/**
57
+	 * Check whether keyCompromise flag is set.
58
+	 *
59
+	 * @return bool
60
+	 */
61
+	public function isKeyCompromise(): bool
62
+	{
63
+		return $this->_flagSet(self::KEY_COMPROMISE);
64
+	}
65 65
     
66
-    /**
67
-     * Check whether cACompromise flag is set.
68
-     *
69
-     * @return bool
70
-     */
71
-    public function isCACompromise(): bool
72
-    {
73
-        return $this->_flagSet(self::CA_COMPROMISE);
74
-    }
66
+	/**
67
+	 * Check whether cACompromise flag is set.
68
+	 *
69
+	 * @return bool
70
+	 */
71
+	public function isCACompromise(): bool
72
+	{
73
+		return $this->_flagSet(self::CA_COMPROMISE);
74
+	}
75 75
     
76
-    /**
77
-     * Check whether affiliationChanged flag is set.
78
-     *
79
-     * @return bool
80
-     */
81
-    public function isAffiliationChanged(): bool
82
-    {
83
-        return $this->_flagSet(self::AFFILIATION_CHANGED);
84
-    }
76
+	/**
77
+	 * Check whether affiliationChanged flag is set.
78
+	 *
79
+	 * @return bool
80
+	 */
81
+	public function isAffiliationChanged(): bool
82
+	{
83
+		return $this->_flagSet(self::AFFILIATION_CHANGED);
84
+	}
85 85
     
86
-    /**
87
-     * Check whether superseded flag is set.
88
-     *
89
-     * @return bool
90
-     */
91
-    public function isSuperseded(): bool
92
-    {
93
-        return $this->_flagSet(self::SUPERSEDED);
94
-    }
86
+	/**
87
+	 * Check whether superseded flag is set.
88
+	 *
89
+	 * @return bool
90
+	 */
91
+	public function isSuperseded(): bool
92
+	{
93
+		return $this->_flagSet(self::SUPERSEDED);
94
+	}
95 95
     
96
-    /**
97
-     * Check whether cessationOfOperation flag is set.
98
-     *
99
-     * @return bool
100
-     */
101
-    public function isCessationOfOperation(): bool
102
-    {
103
-        return $this->_flagSet(self::CESSATION_OF_OPERATION);
104
-    }
96
+	/**
97
+	 * Check whether cessationOfOperation flag is set.
98
+	 *
99
+	 * @return bool
100
+	 */
101
+	public function isCessationOfOperation(): bool
102
+	{
103
+		return $this->_flagSet(self::CESSATION_OF_OPERATION);
104
+	}
105 105
     
106
-    /**
107
-     * Check whether certificateHold flag is set.
108
-     *
109
-     * @return bool
110
-     */
111
-    public function isCertificateHold(): bool
112
-    {
113
-        return $this->_flagSet(self::CERTIFICATE_HOLD);
114
-    }
106
+	/**
107
+	 * Check whether certificateHold flag is set.
108
+	 *
109
+	 * @return bool
110
+	 */
111
+	public function isCertificateHold(): bool
112
+	{
113
+		return $this->_flagSet(self::CERTIFICATE_HOLD);
114
+	}
115 115
     
116
-    /**
117
-     * Check whether privilegeWithdrawn flag is set.
118
-     *
119
-     * @return bool
120
-     */
121
-    public function isPrivilegeWithdrawn(): bool
122
-    {
123
-        return $this->_flagSet(self::PRIVILEGE_WITHDRAWN);
124
-    }
116
+	/**
117
+	 * Check whether privilegeWithdrawn flag is set.
118
+	 *
119
+	 * @return bool
120
+	 */
121
+	public function isPrivilegeWithdrawn(): bool
122
+	{
123
+		return $this->_flagSet(self::PRIVILEGE_WITHDRAWN);
124
+	}
125 125
     
126
-    /**
127
-     * Check whether aACompromise flag is set.
128
-     *
129
-     * @return bool
130
-     */
131
-    public function isAACompromise(): bool
132
-    {
133
-        return $this->_flagSet(self::AA_COMPROMISE);
134
-    }
126
+	/**
127
+	 * Check whether aACompromise flag is set.
128
+	 *
129
+	 * @return bool
130
+	 */
131
+	public function isAACompromise(): bool
132
+	{
133
+		return $this->_flagSet(self::AA_COMPROMISE);
134
+	}
135 135
     
136
-    /**
137
-     * Generate ASN.1 element.
138
-     *
139
-     * @return BitString
140
-     */
141
-    public function toASN1(): BitString
142
-    {
143
-        $flags = new Flags($this->_flags, 9);
144
-        return $flags->bitString()->withoutTrailingZeroes();
145
-    }
136
+	/**
137
+	 * Generate ASN.1 element.
138
+	 *
139
+	 * @return BitString
140
+	 */
141
+	public function toASN1(): BitString
142
+	{
143
+		$flags = new Flags($this->_flags, 9);
144
+		return $flags->bitString()->withoutTrailingZeroes();
145
+	}
146 146
     
147
-    /**
148
-     * Check whether given flag is set.
149
-     *
150
-     * @param int $flag
151
-     * @return boolean
152
-     */
153
-    protected function _flagSet($flag): bool
154
-    {
155
-        return (bool) ($this->_flags & $flag);
156
-    }
147
+	/**
148
+	 * Check whether given flag is set.
149
+	 *
150
+	 * @param int $flag
151
+	 * @return boolean
152
+	 */
153
+	protected function _flagSet($flag): bool
154
+	{
155
+		return (bool) ($this->_flags & $flag);
156
+	}
157 157
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension\DistributionPoint;
6 6
 
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/FreshestCRLExtension.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@
 block discarded – undo
13 13
  */
14 14
 class FreshestCRLExtension extends CRLDistributionPointsExtension
15 15
 {
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @param bool $critical
20
-     * @param DistributionPoint ...$distribution_points
21
-     */
22
-    public function __construct(bool $critical,
23
-        DistributionPoint ...$distribution_points)
24
-    {
25
-        Extension::__construct(self::OID_FRESHEST_CRL, $critical);
26
-        $this->_distributionPoints = $distribution_points;
27
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @param bool $critical
20
+	 * @param DistributionPoint ...$distribution_points
21
+	 */
22
+	public function __construct(bool $critical,
23
+		DistributionPoint ...$distribution_points)
24
+	{
25
+		Extension::__construct(self::OID_FRESHEST_CRL, $critical);
26
+		$this->_distributionPoints = $distribution_points;
27
+	}
28 28
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension;
6 6
 
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/AAControlsExtension.php 2 patches
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -19,215 +19,215 @@
 block discarded – undo
19 19
  */
20 20
 class AAControlsExtension extends Extension
21 21
 {
22
-    /**
23
-     * Path length contraint.
24
-     *
25
-     * @var int|null $_pathLenConstraint
26
-     */
27
-    protected $_pathLenConstraint;
22
+	/**
23
+	 * Path length contraint.
24
+	 *
25
+	 * @var int|null $_pathLenConstraint
26
+	 */
27
+	protected $_pathLenConstraint;
28 28
     
29
-    /**
30
-     * Permitted attributes.
31
-     *
32
-     * Array of OID's.
33
-     *
34
-     * @var string[]|null $_permittedAttrs
35
-     */
36
-    protected $_permittedAttrs;
29
+	/**
30
+	 * Permitted attributes.
31
+	 *
32
+	 * Array of OID's.
33
+	 *
34
+	 * @var string[]|null $_permittedAttrs
35
+	 */
36
+	protected $_permittedAttrs;
37 37
     
38
-    /**
39
-     * Excluded attributes.
40
-     *
41
-     * Array of OID's.
42
-     *
43
-     * @var string[]|null $_excludedAttrs
44
-     */
45
-    protected $_excludedAttrs;
38
+	/**
39
+	 * Excluded attributes.
40
+	 *
41
+	 * Array of OID's.
42
+	 *
43
+	 * @var string[]|null $_excludedAttrs
44
+	 */
45
+	protected $_excludedAttrs;
46 46
     
47
-    /**
48
-     * Whether to permit unspecified attributes.
49
-     *
50
-     * @var bool $_permitUnSpecified
51
-     */
52
-    protected $_permitUnSpecified;
47
+	/**
48
+	 * Whether to permit unspecified attributes.
49
+	 *
50
+	 * @var bool $_permitUnSpecified
51
+	 */
52
+	protected $_permitUnSpecified;
53 53
     
54
-    /**
55
-     * Constructor.
56
-     *
57
-     * @param bool $critical
58
-     * @param int|null $path_len
59
-     * @param string[]|null $permitted
60
-     * @param string[]|null $excluded
61
-     * @param bool $permit_unspecified
62
-     */
63
-    public function __construct(bool $critical, $path_len = null, array $permitted = null,
64
-        array $excluded = null, bool $permit_unspecified = true)
65
-    {
66
-        parent::__construct(self::OID_AA_CONTROLS, $critical);
67
-        $this->_pathLenConstraint = $path_len;
68
-        $this->_permittedAttrs = $permitted;
69
-        $this->_excludedAttrs = $excluded;
70
-        $this->_permitUnSpecified = $permit_unspecified;
71
-    }
54
+	/**
55
+	 * Constructor.
56
+	 *
57
+	 * @param bool $critical
58
+	 * @param int|null $path_len
59
+	 * @param string[]|null $permitted
60
+	 * @param string[]|null $excluded
61
+	 * @param bool $permit_unspecified
62
+	 */
63
+	public function __construct(bool $critical, $path_len = null, array $permitted = null,
64
+		array $excluded = null, bool $permit_unspecified = true)
65
+	{
66
+		parent::__construct(self::OID_AA_CONTROLS, $critical);
67
+		$this->_pathLenConstraint = $path_len;
68
+		$this->_permittedAttrs = $permitted;
69
+		$this->_excludedAttrs = $excluded;
70
+		$this->_permitUnSpecified = $permit_unspecified;
71
+	}
72 72
     
73
-    /**
74
-     *
75
-     * {@inheritdoc}
76
-     * @return self
77
-     */
78
-    protected static function _fromDER($data, $critical)
79
-    {
80
-        $seq = Sequence::fromDER($data);
81
-        $path_len = null;
82
-        $permitted = null;
83
-        $excluded = null;
84
-        $permit_unspecified = true;
85
-        $idx = 0;
86
-        if ($seq->has($idx, Element::TYPE_INTEGER)) {
87
-            $path_len = $seq->at($idx++)
88
-                ->asInteger()
89
-                ->number();
90
-        }
91
-        if ($seq->hasTagged(0)) {
92
-            $attr_seq = $seq->getTagged(0)
93
-                ->asImplicit(Element::TYPE_SEQUENCE)
94
-                ->asSequence();
95
-            $permitted = array_map(
96
-                function (UnspecifiedType $el) {
97
-                    return $el->asObjectIdentifier()->oid();
98
-                }, $attr_seq->elements());
99
-            $idx++;
100
-        }
101
-        if ($seq->hasTagged(1)) {
102
-            $attr_seq = $seq->getTagged(1)
103
-                ->asImplicit(Element::TYPE_SEQUENCE)
104
-                ->asSequence();
105
-            $excluded = array_map(
106
-                function (UnspecifiedType $el) {
107
-                    return $el->asObjectIdentifier()->oid();
108
-                }, $attr_seq->elements());
109
-            $idx++;
110
-        }
111
-        if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
112
-            $permit_unspecified = $seq->at($idx++)
113
-                ->asBoolean()
114
-                ->value();
115
-        }
116
-        return new self($critical, $path_len, $permitted, $excluded,
117
-            $permit_unspecified);
118
-    }
73
+	/**
74
+	 *
75
+	 * {@inheritdoc}
76
+	 * @return self
77
+	 */
78
+	protected static function _fromDER($data, $critical)
79
+	{
80
+		$seq = Sequence::fromDER($data);
81
+		$path_len = null;
82
+		$permitted = null;
83
+		$excluded = null;
84
+		$permit_unspecified = true;
85
+		$idx = 0;
86
+		if ($seq->has($idx, Element::TYPE_INTEGER)) {
87
+			$path_len = $seq->at($idx++)
88
+				->asInteger()
89
+				->number();
90
+		}
91
+		if ($seq->hasTagged(0)) {
92
+			$attr_seq = $seq->getTagged(0)
93
+				->asImplicit(Element::TYPE_SEQUENCE)
94
+				->asSequence();
95
+			$permitted = array_map(
96
+				function (UnspecifiedType $el) {
97
+					return $el->asObjectIdentifier()->oid();
98
+				}, $attr_seq->elements());
99
+			$idx++;
100
+		}
101
+		if ($seq->hasTagged(1)) {
102
+			$attr_seq = $seq->getTagged(1)
103
+				->asImplicit(Element::TYPE_SEQUENCE)
104
+				->asSequence();
105
+			$excluded = array_map(
106
+				function (UnspecifiedType $el) {
107
+					return $el->asObjectIdentifier()->oid();
108
+				}, $attr_seq->elements());
109
+			$idx++;
110
+		}
111
+		if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
112
+			$permit_unspecified = $seq->at($idx++)
113
+				->asBoolean()
114
+				->value();
115
+		}
116
+		return new self($critical, $path_len, $permitted, $excluded,
117
+			$permit_unspecified);
118
+	}
119 119
     
120
-    /**
121
-     * Check whether path length constraint is present.
122
-     *
123
-     * @return bool
124
-     */
125
-    public function hasPathLen(): bool
126
-    {
127
-        return isset($this->_pathLenConstraint);
128
-    }
120
+	/**
121
+	 * Check whether path length constraint is present.
122
+	 *
123
+	 * @return bool
124
+	 */
125
+	public function hasPathLen(): bool
126
+	{
127
+		return isset($this->_pathLenConstraint);
128
+	}
129 129
     
130
-    /**
131
-     * Get path length constraint.
132
-     *
133
-     * @throws \LogicException
134
-     * @return int
135
-     */
136
-    public function pathLen(): int
137
-    {
138
-        if (!$this->hasPathLen()) {
139
-            throw new \LogicException("pathLen not set.");
140
-        }
141
-        return $this->_pathLenConstraint;
142
-    }
130
+	/**
131
+	 * Get path length constraint.
132
+	 *
133
+	 * @throws \LogicException
134
+	 * @return int
135
+	 */
136
+	public function pathLen(): int
137
+	{
138
+		if (!$this->hasPathLen()) {
139
+			throw new \LogicException("pathLen not set.");
140
+		}
141
+		return $this->_pathLenConstraint;
142
+	}
143 143
     
144
-    /**
145
-     * Check whether permitted attributes are present.
146
-     *
147
-     * @return bool
148
-     */
149
-    public function hasPermittedAttrs(): bool
150
-    {
151
-        return isset($this->_permittedAttrs);
152
-    }
144
+	/**
145
+	 * Check whether permitted attributes are present.
146
+	 *
147
+	 * @return bool
148
+	 */
149
+	public function hasPermittedAttrs(): bool
150
+	{
151
+		return isset($this->_permittedAttrs);
152
+	}
153 153
     
154
-    /**
155
-     * Get OID's of permitted attributes.
156
-     *
157
-     * @throws \LogicException
158
-     * @return string[]
159
-     */
160
-    public function permittedAttrs(): array
161
-    {
162
-        if (!$this->hasPermittedAttrs()) {
163
-            throw new \LogicException("permittedAttrs not set.");
164
-        }
165
-        return $this->_permittedAttrs;
166
-    }
154
+	/**
155
+	 * Get OID's of permitted attributes.
156
+	 *
157
+	 * @throws \LogicException
158
+	 * @return string[]
159
+	 */
160
+	public function permittedAttrs(): array
161
+	{
162
+		if (!$this->hasPermittedAttrs()) {
163
+			throw new \LogicException("permittedAttrs not set.");
164
+		}
165
+		return $this->_permittedAttrs;
166
+	}
167 167
     
168
-    /**
169
-     * Check whether excluded attributes are present.
170
-     *
171
-     * @return bool
172
-     */
173
-    public function hasExcludedAttrs(): bool
174
-    {
175
-        return isset($this->_excludedAttrs);
176
-    }
168
+	/**
169
+	 * Check whether excluded attributes are present.
170
+	 *
171
+	 * @return bool
172
+	 */
173
+	public function hasExcludedAttrs(): bool
174
+	{
175
+		return isset($this->_excludedAttrs);
176
+	}
177 177
     
178
-    /**
179
-     * Get OID's of excluded attributes.
180
-     *
181
-     * @throws \LogicException
182
-     * @return string[]
183
-     */
184
-    public function excludedAttrs(): array
185
-    {
186
-        if (!$this->hasExcludedAttrs()) {
187
-            throw new \LogicException("excludedAttrs not set.");
188
-        }
189
-        return $this->_excludedAttrs;
190
-    }
178
+	/**
179
+	 * Get OID's of excluded attributes.
180
+	 *
181
+	 * @throws \LogicException
182
+	 * @return string[]
183
+	 */
184
+	public function excludedAttrs(): array
185
+	{
186
+		if (!$this->hasExcludedAttrs()) {
187
+			throw new \LogicException("excludedAttrs not set.");
188
+		}
189
+		return $this->_excludedAttrs;
190
+	}
191 191
     
192
-    /**
193
-     * Whether to permit attributes that are not explicitly specified in
194
-     * neither permitted nor excluded list.
195
-     *
196
-     * @return bool
197
-     */
198
-    public function permitUnspecified(): bool
199
-    {
200
-        return $this->_permitUnSpecified;
201
-    }
192
+	/**
193
+	 * Whether to permit attributes that are not explicitly specified in
194
+	 * neither permitted nor excluded list.
195
+	 *
196
+	 * @return bool
197
+	 */
198
+	public function permitUnspecified(): bool
199
+	{
200
+		return $this->_permitUnSpecified;
201
+	}
202 202
     
203
-    /**
204
-     *
205
-     * {@inheritdoc}
206
-     * @return Sequence
207
-     */
208
-    protected function _valueASN1(): Sequence
209
-    {
210
-        $elements = array();
211
-        if (isset($this->_pathLenConstraint)) {
212
-            $elements[] = new Integer($this->_pathLenConstraint);
213
-        }
214
-        if (isset($this->_permittedAttrs)) {
215
-            $oids = array_map(
216
-                function ($oid) {
217
-                    return new ObjectIdentifier($oid);
218
-                }, $this->_permittedAttrs);
219
-            $elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids));
220
-        }
221
-        if (isset($this->_excludedAttrs)) {
222
-            $oids = array_map(
223
-                function ($oid) {
224
-                    return new ObjectIdentifier($oid);
225
-                }, $this->_excludedAttrs);
226
-            $elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids));
227
-        }
228
-        if ($this->_permitUnSpecified !== true) {
229
-            $elements[] = new Boolean(false);
230
-        }
231
-        return new Sequence(...$elements);
232
-    }
203
+	/**
204
+	 *
205
+	 * {@inheritdoc}
206
+	 * @return Sequence
207
+	 */
208
+	protected function _valueASN1(): Sequence
209
+	{
210
+		$elements = array();
211
+		if (isset($this->_pathLenConstraint)) {
212
+			$elements[] = new Integer($this->_pathLenConstraint);
213
+		}
214
+		if (isset($this->_permittedAttrs)) {
215
+			$oids = array_map(
216
+				function ($oid) {
217
+					return new ObjectIdentifier($oid);
218
+				}, $this->_permittedAttrs);
219
+			$elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids));
220
+		}
221
+		if (isset($this->_excludedAttrs)) {
222
+			$oids = array_map(
223
+				function ($oid) {
224
+					return new ObjectIdentifier($oid);
225
+				}, $this->_excludedAttrs);
226
+			$elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids));
227
+		}
228
+		if ($this->_permitUnSpecified !== true) {
229
+			$elements[] = new Boolean(false);
230
+		}
231
+		return new Sequence(...$elements);
232
+	}
233 233
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension;
6 6
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 ->asImplicit(Element::TYPE_SEQUENCE)
94 94
                 ->asSequence();
95 95
             $permitted = array_map(
96
-                function (UnspecifiedType $el) {
96
+                function(UnspecifiedType $el) {
97 97
                     return $el->asObjectIdentifier()->oid();
98 98
                 }, $attr_seq->elements());
99 99
             $idx++;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 ->asImplicit(Element::TYPE_SEQUENCE)
104 104
                 ->asSequence();
105 105
             $excluded = array_map(
106
-                function (UnspecifiedType $el) {
106
+                function(UnspecifiedType $el) {
107 107
                     return $el->asObjectIdentifier()->oid();
108 108
                 }, $attr_seq->elements());
109 109
             $idx++;
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
         }
214 214
         if (isset($this->_permittedAttrs)) {
215 215
             $oids = array_map(
216
-                function ($oid) {
216
+                function($oid) {
217 217
                     return new ObjectIdentifier($oid);
218 218
                 }, $this->_permittedAttrs);
219 219
             $elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids));
220 220
         }
221 221
         if (isset($this->_excludedAttrs)) {
222 222
             $oids = array_map(
223
-                function ($oid) {
223
+                function($oid) {
224 224
                     return new ObjectIdentifier($oid);
225 225
                 }, $this->_excludedAttrs);
226 226
             $elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids));
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/PolicyMappingsExtension.php 2 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -15,170 +15,170 @@
 block discarded – undo
15 15
  * @link https://tools.ietf.org/html/rfc5280#section-4.2.1.5
16 16
  */
17 17
 class PolicyMappingsExtension extends Extension implements 
18
-    \Countable,
19
-    \IteratorAggregate
18
+	\Countable,
19
+	\IteratorAggregate
20 20
 {
21
-    /**
22
-     * Policy mappings.
23
-     *
24
-     * @var PolicyMapping[] $_mappings
25
-     */
26
-    protected $_mappings;
21
+	/**
22
+	 * Policy mappings.
23
+	 *
24
+	 * @var PolicyMapping[] $_mappings
25
+	 */
26
+	protected $_mappings;
27 27
     
28
-    /**
29
-     * Constructor.
30
-     *
31
-     * @param bool $critical
32
-     * @param PolicyMapping[] $mappings One or more PolicyMapping objects
33
-     */
34
-    public function __construct(bool $critical, PolicyMapping ...$mappings)
35
-    {
36
-        parent::__construct(self::OID_POLICY_MAPPINGS, $critical);
37
-        $this->_mappings = $mappings;
38
-    }
28
+	/**
29
+	 * Constructor.
30
+	 *
31
+	 * @param bool $critical
32
+	 * @param PolicyMapping[] $mappings One or more PolicyMapping objects
33
+	 */
34
+	public function __construct(bool $critical, PolicyMapping ...$mappings)
35
+	{
36
+		parent::__construct(self::OID_POLICY_MAPPINGS, $critical);
37
+		$this->_mappings = $mappings;
38
+	}
39 39
     
40
-    /**
41
-     *
42
-     * {@inheritdoc}
43
-     * @return self
44
-     */
45
-    protected static function _fromDER($data, $critical)
46
-    {
47
-        $mappings = array_map(
48
-            function (UnspecifiedType $el) {
49
-                return PolicyMapping::fromASN1($el->asSequence());
50
-            }, Sequence::fromDER($data)->elements());
51
-        if (!count($mappings)) {
52
-            throw new \UnexpectedValueException(
53
-                "PolicyMappings must have at least one mapping.");
54
-        }
55
-        return new self($critical, ...$mappings);
56
-    }
40
+	/**
41
+	 *
42
+	 * {@inheritdoc}
43
+	 * @return self
44
+	 */
45
+	protected static function _fromDER($data, $critical)
46
+	{
47
+		$mappings = array_map(
48
+			function (UnspecifiedType $el) {
49
+				return PolicyMapping::fromASN1($el->asSequence());
50
+			}, Sequence::fromDER($data)->elements());
51
+		if (!count($mappings)) {
52
+			throw new \UnexpectedValueException(
53
+				"PolicyMappings must have at least one mapping.");
54
+		}
55
+		return new self($critical, ...$mappings);
56
+	}
57 57
     
58
-    /**
59
-     *
60
-     * {@inheritdoc}
61
-     * @return Sequence
62
-     */
63
-    protected function _valueASN1(): Sequence
64
-    {
65
-        if (!count($this->_mappings)) {
66
-            throw new \LogicException("No mappings.");
67
-        }
68
-        $elements = array_map(
69
-            function (PolicyMapping $mapping) {
70
-                return $mapping->toASN1();
71
-            }, $this->_mappings);
72
-        return new Sequence(...$elements);
73
-    }
58
+	/**
59
+	 *
60
+	 * {@inheritdoc}
61
+	 * @return Sequence
62
+	 */
63
+	protected function _valueASN1(): Sequence
64
+	{
65
+		if (!count($this->_mappings)) {
66
+			throw new \LogicException("No mappings.");
67
+		}
68
+		$elements = array_map(
69
+			function (PolicyMapping $mapping) {
70
+				return $mapping->toASN1();
71
+			}, $this->_mappings);
72
+		return new Sequence(...$elements);
73
+	}
74 74
     
75
-    /**
76
-     * Get all mappings.
77
-     *
78
-     * @return PolicyMapping[]
79
-     */
80
-    public function mappings(): array
81
-    {
82
-        return $this->_mappings;
83
-    }
75
+	/**
76
+	 * Get all mappings.
77
+	 *
78
+	 * @return PolicyMapping[]
79
+	 */
80
+	public function mappings(): array
81
+	{
82
+		return $this->_mappings;
83
+	}
84 84
     
85
-    /**
86
-     * Get mappings flattened into a single array of arrays of subject domains
87
-     * keyed by issuer domain.
88
-     *
89
-     * Eg. if policy mappings contains multiple mappings with the same issuer
90
-     * domain policy, their corresponding subject domain policies are placed
91
-     * under the same key.
92
-     *
93
-     * @return (string[])[]
94
-     */
95
-    public function flattenedMappings(): array
96
-    {
97
-        $mappings = array();
98
-        foreach ($this->_mappings as $mapping) {
99
-            $idp = $mapping->issuerDomainPolicy();
100
-            if (!isset($mappings[$idp])) {
101
-                $mappings[$idp] = array();
102
-            }
103
-            array_push($mappings[$idp], $mapping->subjectDomainPolicy());
104
-        }
105
-        return $mappings;
106
-    }
85
+	/**
86
+	 * Get mappings flattened into a single array of arrays of subject domains
87
+	 * keyed by issuer domain.
88
+	 *
89
+	 * Eg. if policy mappings contains multiple mappings with the same issuer
90
+	 * domain policy, their corresponding subject domain policies are placed
91
+	 * under the same key.
92
+	 *
93
+	 * @return (string[])[]
94
+	 */
95
+	public function flattenedMappings(): array
96
+	{
97
+		$mappings = array();
98
+		foreach ($this->_mappings as $mapping) {
99
+			$idp = $mapping->issuerDomainPolicy();
100
+			if (!isset($mappings[$idp])) {
101
+				$mappings[$idp] = array();
102
+			}
103
+			array_push($mappings[$idp], $mapping->subjectDomainPolicy());
104
+		}
105
+		return $mappings;
106
+	}
107 107
     
108
-    /**
109
-     * Get all subject domain policy OIDs that are mapped to given issuer
110
-     * domain policy OID.
111
-     *
112
-     * @param string $oid Issuer domain policy
113
-     * @return string[] List of OIDs in dotted format
114
-     */
115
-    public function issuerMappings(string $oid): array
116
-    {
117
-        $oids = array();
118
-        foreach ($this->_mappings as $mapping) {
119
-            if ($mapping->issuerDomainPolicy() == $oid) {
120
-                $oids[] = $mapping->subjectDomainPolicy();
121
-            }
122
-        }
123
-        return $oids;
124
-    }
108
+	/**
109
+	 * Get all subject domain policy OIDs that are mapped to given issuer
110
+	 * domain policy OID.
111
+	 *
112
+	 * @param string $oid Issuer domain policy
113
+	 * @return string[] List of OIDs in dotted format
114
+	 */
115
+	public function issuerMappings(string $oid): array
116
+	{
117
+		$oids = array();
118
+		foreach ($this->_mappings as $mapping) {
119
+			if ($mapping->issuerDomainPolicy() == $oid) {
120
+				$oids[] = $mapping->subjectDomainPolicy();
121
+			}
122
+		}
123
+		return $oids;
124
+	}
125 125
     
126
-    /**
127
-     * Get all mapped issuer domain policy OIDs.
128
-     *
129
-     * @return string[]
130
-     */
131
-    public function issuerDomainPolicies(): array
132
-    {
133
-        $idps = array_map(
134
-            function (PolicyMapping $mapping) {
135
-                return $mapping->issuerDomainPolicy();
136
-            }, $this->_mappings);
137
-        return array_values(array_unique($idps));
138
-    }
126
+	/**
127
+	 * Get all mapped issuer domain policy OIDs.
128
+	 *
129
+	 * @return string[]
130
+	 */
131
+	public function issuerDomainPolicies(): array
132
+	{
133
+		$idps = array_map(
134
+			function (PolicyMapping $mapping) {
135
+				return $mapping->issuerDomainPolicy();
136
+			}, $this->_mappings);
137
+		return array_values(array_unique($idps));
138
+	}
139 139
     
140
-    /**
141
-     * Check whether policy mappings have anyPolicy mapped.
142
-     *
143
-     * RFC 5280 section 4.2.1.5 states that "Policies MUST NOT be mapped either
144
-     * to or from the special value anyPolicy".
145
-     *
146
-     * @return bool
147
-     */
148
-    public function hasAnyPolicyMapping(): bool
149
-    {
150
-        foreach ($this->_mappings as $mapping) {
151
-            if ($mapping->issuerDomainPolicy() ==
152
-                 PolicyInformation::OID_ANY_POLICY) {
153
-                return true;
154
-            }
155
-            if ($mapping->subjectDomainPolicy() ==
156
-                 PolicyInformation::OID_ANY_POLICY) {
157
-                return true;
158
-            }
159
-        }
160
-        return false;
161
-    }
140
+	/**
141
+	 * Check whether policy mappings have anyPolicy mapped.
142
+	 *
143
+	 * RFC 5280 section 4.2.1.5 states that "Policies MUST NOT be mapped either
144
+	 * to or from the special value anyPolicy".
145
+	 *
146
+	 * @return bool
147
+	 */
148
+	public function hasAnyPolicyMapping(): bool
149
+	{
150
+		foreach ($this->_mappings as $mapping) {
151
+			if ($mapping->issuerDomainPolicy() ==
152
+				 PolicyInformation::OID_ANY_POLICY) {
153
+				return true;
154
+			}
155
+			if ($mapping->subjectDomainPolicy() ==
156
+				 PolicyInformation::OID_ANY_POLICY) {
157
+				return true;
158
+			}
159
+		}
160
+		return false;
161
+	}
162 162
     
163
-    /**
164
-     * Get the number of mappings.
165
-     *
166
-     * @see \Countable::count()
167
-     * @return int
168
-     */
169
-    public function count(): int
170
-    {
171
-        return count($this->_mappings);
172
-    }
163
+	/**
164
+	 * Get the number of mappings.
165
+	 *
166
+	 * @see \Countable::count()
167
+	 * @return int
168
+	 */
169
+	public function count(): int
170
+	{
171
+		return count($this->_mappings);
172
+	}
173 173
     
174
-    /**
175
-     * Get iterator for policy mappings.
176
-     *
177
-     * @see \IteratorAggregate::getIterator()
178
-     * @return \ArrayIterator
179
-     */
180
-    public function getIterator(): \ArrayIterator
181
-    {
182
-        return new \ArrayIterator($this->_mappings);
183
-    }
174
+	/**
175
+	 * Get iterator for policy mappings.
176
+	 *
177
+	 * @see \IteratorAggregate::getIterator()
178
+	 * @return \ArrayIterator
179
+	 */
180
+	public function getIterator(): \ArrayIterator
181
+	{
182
+		return new \ArrayIterator($this->_mappings);
183
+	}
184 184
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension;
6 6
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     protected static function _fromDER($data, $critical)
46 46
     {
47 47
         $mappings = array_map(
48
-            function (UnspecifiedType $el) {
48
+            function(UnspecifiedType $el) {
49 49
                 return PolicyMapping::fromASN1($el->asSequence());
50 50
             }, Sequence::fromDER($data)->elements());
51 51
         if (!count($mappings)) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             throw new \LogicException("No mappings.");
67 67
         }
68 68
         $elements = array_map(
69
-            function (PolicyMapping $mapping) {
69
+            function(PolicyMapping $mapping) {
70 70
                 return $mapping->toASN1();
71 71
             }, $this->_mappings);
72 72
         return new Sequence(...$elements);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     public function issuerDomainPolicies(): array
132 132
     {
133 133
         $idps = array_map(
134
-            function (PolicyMapping $mapping) {
134
+            function(PolicyMapping $mapping) {
135 135
                 return $mapping->issuerDomainPolicy();
136 136
             }, $this->_mappings);
137 137
         return array_values(array_unique($idps));
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/IssuerAlternativeNameExtension.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -14,53 +14,53 @@
 block discarded – undo
14 14
  */
15 15
 class IssuerAlternativeNameExtension extends Extension
16 16
 {
17
-    /**
18
-     * Names.
19
-     *
20
-     * @var GeneralNames
21
-     */
22
-    protected $_names;
17
+	/**
18
+	 * Names.
19
+	 *
20
+	 * @var GeneralNames
21
+	 */
22
+	protected $_names;
23 23
     
24
-    /**
25
-     * Constructor.
26
-     *
27
-     * @param bool $critical
28
-     * @param GeneralNames $names
29
-     */
30
-    public function __construct(bool $critical, GeneralNames $names)
31
-    {
32
-        parent::__construct(self::OID_ISSUER_ALT_NAME, $critical);
33
-        $this->_names = $names;
34
-    }
24
+	/**
25
+	 * Constructor.
26
+	 *
27
+	 * @param bool $critical
28
+	 * @param GeneralNames $names
29
+	 */
30
+	public function __construct(bool $critical, GeneralNames $names)
31
+	{
32
+		parent::__construct(self::OID_ISSUER_ALT_NAME, $critical);
33
+		$this->_names = $names;
34
+	}
35 35
     
36
-    /**
37
-     *
38
-     * {@inheritdoc}
39
-     * @return self
40
-     */
41
-    protected static function _fromDER($data, $critical)
42
-    {
43
-        return new self($critical,
44
-            GeneralNames::fromASN1(Sequence::fromDER($data)));
45
-    }
36
+	/**
37
+	 *
38
+	 * {@inheritdoc}
39
+	 * @return self
40
+	 */
41
+	protected static function _fromDER($data, $critical)
42
+	{
43
+		return new self($critical,
44
+			GeneralNames::fromASN1(Sequence::fromDER($data)));
45
+	}
46 46
     
47
-    /**
48
-     * Get names.
49
-     *
50
-     * @return GeneralNames
51
-     */
52
-    public function names(): GeneralNames
53
-    {
54
-        return $this->_names;
55
-    }
47
+	/**
48
+	 * Get names.
49
+	 *
50
+	 * @return GeneralNames
51
+	 */
52
+	public function names(): GeneralNames
53
+	{
54
+		return $this->_names;
55
+	}
56 56
     
57
-    /**
58
-     *
59
-     * {@inheritdoc}
60
-     * @return Sequence
61
-     */
62
-    protected function _valueASN1(): Sequence
63
-    {
64
-        return $this->_names->toASN1();
65
-    }
57
+	/**
58
+	 *
59
+	 * {@inheritdoc}
60
+	 * @return Sequence
61
+	 */
62
+	protected function _valueASN1(): Sequence
63
+	{
64
+		return $this->_names->toASN1();
65
+	}
66 66
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension;
6 6
 
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/UnknownExtension.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,32 +11,32 @@
 block discarded – undo
11 11
  */
12 12
 class UnknownExtension extends Extension
13 13
 {
14
-    /**
15
-     * Extension value.
16
-     *
17
-     * @var Element $_element
18
-     */
19
-    protected $_element;
14
+	/**
15
+	 * Extension value.
16
+	 *
17
+	 * @var Element $_element
18
+	 */
19
+	protected $_element;
20 20
     
21
-    /**
22
-     * Constructor.
23
-     *
24
-     * @param string $oid
25
-     * @param bool $critical
26
-     * @param Element $data
27
-     */
28
-    public function __construct(string $oid, bool $critical, Element $data)
29
-    {
30
-        parent::__construct($oid, $critical);
31
-        $this->_element = $data;
32
-    }
21
+	/**
22
+	 * Constructor.
23
+	 *
24
+	 * @param string $oid
25
+	 * @param bool $critical
26
+	 * @param Element $data
27
+	 */
28
+	public function __construct(string $oid, bool $critical, Element $data)
29
+	{
30
+		parent::__construct($oid, $critical);
31
+		$this->_element = $data;
32
+	}
33 33
     
34
-    /**
35
-     *
36
-     * {@inheritdoc}
37
-     */
38
-    protected function _valueASN1()
39
-    {
40
-        return $this->_element;
41
-    }
34
+	/**
35
+	 *
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected function _valueASN1()
39
+	{
40
+		return $this->_element;
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension;
6 6
 
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/SubjectKeyIdentifierExtension.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -13,52 +13,52 @@
 block discarded – undo
13 13
  */
14 14
 class SubjectKeyIdentifierExtension extends Extension
15 15
 {
16
-    /**
17
-     * Key identifier.
18
-     *
19
-     * @var string $_keyIdentifier
20
-     */
21
-    protected $_keyIdentifier;
16
+	/**
17
+	 * Key identifier.
18
+	 *
19
+	 * @var string $_keyIdentifier
20
+	 */
21
+	protected $_keyIdentifier;
22 22
     
23
-    /**
24
-     * Constructor.
25
-     *
26
-     * @param bool $critical
27
-     * @param string $keyIdentifier
28
-     */
29
-    public function __construct(bool $critical, string $keyIdentifier)
30
-    {
31
-        parent::__construct(self::OID_SUBJECT_KEY_IDENTIFIER, $critical);
32
-        $this->_keyIdentifier = $keyIdentifier;
33
-    }
23
+	/**
24
+	 * Constructor.
25
+	 *
26
+	 * @param bool $critical
27
+	 * @param string $keyIdentifier
28
+	 */
29
+	public function __construct(bool $critical, string $keyIdentifier)
30
+	{
31
+		parent::__construct(self::OID_SUBJECT_KEY_IDENTIFIER, $critical);
32
+		$this->_keyIdentifier = $keyIdentifier;
33
+	}
34 34
     
35
-    /**
36
-     *
37
-     * {@inheritdoc}
38
-     * @return self
39
-     */
40
-    protected static function _fromDER($data, $critical)
41
-    {
42
-        return new self($critical, OctetString::fromDER($data)->string());
43
-    }
35
+	/**
36
+	 *
37
+	 * {@inheritdoc}
38
+	 * @return self
39
+	 */
40
+	protected static function _fromDER($data, $critical)
41
+	{
42
+		return new self($critical, OctetString::fromDER($data)->string());
43
+	}
44 44
     
45
-    /**
46
-     * Get key identifier.
47
-     *
48
-     * @return string
49
-     */
50
-    public function keyIdentifier(): string
51
-    {
52
-        return $this->_keyIdentifier;
53
-    }
45
+	/**
46
+	 * Get key identifier.
47
+	 *
48
+	 * @return string
49
+	 */
50
+	public function keyIdentifier(): string
51
+	{
52
+		return $this->_keyIdentifier;
53
+	}
54 54
     
55
-    /**
56
-     *
57
-     * {@inheritdoc}
58
-     * @return OctetString
59
-     */
60
-    protected function _valueASN1(): OctetString
61
-    {
62
-        return new OctetString($this->_keyIdentifier);
63
-    }
55
+	/**
56
+	 *
57
+	 * {@inheritdoc}
58
+	 * @return OctetString
59
+	 */
60
+	protected function _valueASN1(): OctetString
61
+	{
62
+		return new OctetString($this->_keyIdentifier);
63
+	}
64 64
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace X509\Certificate\Extension;
6 6
 
Please login to merge, or discard this patch.