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.
Passed
Push — master ( f7ba31...da62d3 )
by Joni
02:58
created
lib/X509/AttributeCertificate/Attribute/ChargingIdentityAttributeValue.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
  */
10 10
 class ChargingIdentityAttributeValue extends IetfAttrSyntax
11 11
 {
12
-    const OID = "1.3.6.1.5.5.7.10.3";
12
+	const OID = "1.3.6.1.5.5.7.10.3";
13 13
     
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param IetfAttrValue ...$values
18
-     */
19
-    public function __construct(IetfAttrValue ...$values)
20
-    {
21
-        parent::__construct(...$values);
22
-        $this->_oid = self::OID;
23
-    }
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param IetfAttrValue ...$values
18
+	 */
19
+	public function __construct(IetfAttrValue ...$values)
20
+	{
21
+		parent::__construct(...$values);
22
+		$this->_oid = self::OID;
23
+	}
24 24
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/GroupAttributeValue.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
  */
10 10
 class GroupAttributeValue extends IetfAttrSyntax
11 11
 {
12
-    const OID = "1.3.6.1.5.5.7.10.4";
12
+	const OID = "1.3.6.1.5.5.7.10.4";
13 13
     
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param IetfAttrValue ...$values
18
-     */
19
-    public function __construct(IetfAttrValue ...$values)
20
-    {
21
-        parent::__construct(...$values);
22
-        $this->_oid = self::OID;
23
-    }
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param IetfAttrValue ...$values
18
+	 */
19
+	public function __construct(IetfAttrValue ...$values)
20
+	{
21
+		parent::__construct(...$values);
22
+		$this->_oid = self::OID;
23
+	}
24 24
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -40,6 +40,7 @@
 block discarded – undo
40 40
      * Constructor.
41 41
      * 
42 42
      * @param IetfAttrValue ...$values
43
+     * @param IetfAttrValue[] $values
43 44
      */
44 45
     public function __construct(IetfAttrValue ...$values)
45 46
     {
Please login to merge, or discard this patch.
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -19,203 +19,203 @@
 block discarded – undo
19 19
  * @link https://tools.ietf.org/html/rfc5755#section-4.4
20 20
  */
21 21
 abstract class IetfAttrSyntax extends AttributeValue implements 
22
-    \Countable,
23
-    \IteratorAggregate
22
+	\Countable,
23
+	\IteratorAggregate
24 24
 {
25
-    /**
26
-     * Policy authority.
27
-     *
28
-     * @var GeneralNames|null $_policyAuthority
29
-     */
30
-    protected $_policyAuthority;
25
+	/**
26
+	 * Policy authority.
27
+	 *
28
+	 * @var GeneralNames|null $_policyAuthority
29
+	 */
30
+	protected $_policyAuthority;
31 31
     
32
-    /**
33
-     * Values.
34
-     *
35
-     * @var IetfAttrValue[] $_values
36
-     */
37
-    protected $_values;
32
+	/**
33
+	 * Values.
34
+	 *
35
+	 * @var IetfAttrValue[] $_values
36
+	 */
37
+	protected $_values;
38 38
     
39
-    /**
40
-     * Constructor.
41
-     * 
42
-     * @param IetfAttrValue ...$values
43
-     */
44
-    public function __construct(IetfAttrValue ...$values)
45
-    {
46
-        $this->_policyAuthority = null;
47
-        $this->_values = $values;
48
-    }
39
+	/**
40
+	 * Constructor.
41
+	 * 
42
+	 * @param IetfAttrValue ...$values
43
+	 */
44
+	public function __construct(IetfAttrValue ...$values)
45
+	{
46
+		$this->_policyAuthority = null;
47
+		$this->_values = $values;
48
+	}
49 49
     
50
-    /**
51
-     *
52
-     * @param UnspecifiedType $el
53
-     * @return self
54
-     */
55
-    public static function fromASN1(UnspecifiedType $el): self
56
-    {
57
-        $seq = $el->asSequence();
58
-        $authority = null;
59
-        $idx = 0;
60
-        if ($seq->hasTagged(0)) {
61
-            $authority = GeneralNames::fromASN1(
62
-                $seq->getTagged(0)
63
-                    ->asImplicit(Element::TYPE_SEQUENCE)
64
-                    ->asSequence());
65
-            ++$idx;
66
-        }
67
-        $values = array_map(
68
-            function (UnspecifiedType $el) {
69
-                return IetfAttrValue::fromASN1($el);
70
-            },
71
-            $seq->at($idx)
72
-                ->asSequence()
73
-                ->elements());
74
-        $obj = new static(...$values);
75
-        $obj->_policyAuthority = $authority;
76
-        return $obj;
77
-    }
50
+	/**
51
+	 *
52
+	 * @param UnspecifiedType $el
53
+	 * @return self
54
+	 */
55
+	public static function fromASN1(UnspecifiedType $el): self
56
+	{
57
+		$seq = $el->asSequence();
58
+		$authority = null;
59
+		$idx = 0;
60
+		if ($seq->hasTagged(0)) {
61
+			$authority = GeneralNames::fromASN1(
62
+				$seq->getTagged(0)
63
+					->asImplicit(Element::TYPE_SEQUENCE)
64
+					->asSequence());
65
+			++$idx;
66
+		}
67
+		$values = array_map(
68
+			function (UnspecifiedType $el) {
69
+				return IetfAttrValue::fromASN1($el);
70
+			},
71
+			$seq->at($idx)
72
+				->asSequence()
73
+				->elements());
74
+		$obj = new static(...$values);
75
+		$obj->_policyAuthority = $authority;
76
+		return $obj;
77
+	}
78 78
     
79
-    /**
80
-     * Get self with policy authority.
81
-     *
82
-     * @param GeneralNames $names
83
-     * @return self
84
-     */
85
-    public function withPolicyAuthority(GeneralNames $names): self
86
-    {
87
-        $obj = clone $this;
88
-        $obj->_policyAuthority = $names;
89
-        return $obj;
90
-    }
79
+	/**
80
+	 * Get self with policy authority.
81
+	 *
82
+	 * @param GeneralNames $names
83
+	 * @return self
84
+	 */
85
+	public function withPolicyAuthority(GeneralNames $names): self
86
+	{
87
+		$obj = clone $this;
88
+		$obj->_policyAuthority = $names;
89
+		return $obj;
90
+	}
91 91
     
92
-    /**
93
-     * Check whether policy authority is present.
94
-     *
95
-     * @return bool
96
-     */
97
-    public function hasPolicyAuthority(): bool
98
-    {
99
-        return isset($this->_policyAuthority);
100
-    }
92
+	/**
93
+	 * Check whether policy authority is present.
94
+	 *
95
+	 * @return bool
96
+	 */
97
+	public function hasPolicyAuthority(): bool
98
+	{
99
+		return isset($this->_policyAuthority);
100
+	}
101 101
     
102
-    /**
103
-     * Get policy authority.
104
-     *
105
-     * @throws \LogicException
106
-     * @return GeneralNames
107
-     */
108
-    public function policyAuthority(): GeneralNames
109
-    {
110
-        if (!$this->hasPolicyAuthority()) {
111
-            throw new \LogicException("policyAuthority not set.");
112
-        }
113
-        return $this->_policyAuthority;
114
-    }
102
+	/**
103
+	 * Get policy authority.
104
+	 *
105
+	 * @throws \LogicException
106
+	 * @return GeneralNames
107
+	 */
108
+	public function policyAuthority(): GeneralNames
109
+	{
110
+		if (!$this->hasPolicyAuthority()) {
111
+			throw new \LogicException("policyAuthority not set.");
112
+		}
113
+		return $this->_policyAuthority;
114
+	}
115 115
     
116
-    /**
117
-     * Get values.
118
-     *
119
-     * @return IetfAttrValue[]
120
-     */
121
-    public function values(): array
122
-    {
123
-        return $this->_values;
124
-    }
116
+	/**
117
+	 * Get values.
118
+	 *
119
+	 * @return IetfAttrValue[]
120
+	 */
121
+	public function values(): array
122
+	{
123
+		return $this->_values;
124
+	}
125 125
     
126
-    /**
127
-     * Get first value.
128
-     *
129
-     * @throws \LogicException
130
-     * @return IetfAttrValue
131
-     */
132
-    public function first(): IetfAttrValue
133
-    {
134
-        if (!count($this->_values)) {
135
-            throw new \LogicException("No values.");
136
-        }
137
-        return $this->_values[0];
138
-    }
126
+	/**
127
+	 * Get first value.
128
+	 *
129
+	 * @throws \LogicException
130
+	 * @return IetfAttrValue
131
+	 */
132
+	public function first(): IetfAttrValue
133
+	{
134
+		if (!count($this->_values)) {
135
+			throw new \LogicException("No values.");
136
+		}
137
+		return $this->_values[0];
138
+	}
139 139
     
140
-    /**
141
-     *
142
-     * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
143
-     * @return Sequence
144
-     */
145
-    public function toASN1(): Sequence
146
-    {
147
-        $elements = array();
148
-        if (isset($this->_policyAuthority)) {
149
-            $elements[] = new ImplicitlyTaggedType(0,
150
-                $this->_policyAuthority->toASN1());
151
-        }
152
-        $values = array_map(
153
-            function (IetfAttrValue $val) {
154
-                return $val->toASN1();
155
-            }, $this->_values);
156
-        $elements[] = new Sequence(...$values);
157
-        return new Sequence(...$elements);
158
-    }
140
+	/**
141
+	 *
142
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
143
+	 * @return Sequence
144
+	 */
145
+	public function toASN1(): Sequence
146
+	{
147
+		$elements = array();
148
+		if (isset($this->_policyAuthority)) {
149
+			$elements[] = new ImplicitlyTaggedType(0,
150
+				$this->_policyAuthority->toASN1());
151
+		}
152
+		$values = array_map(
153
+			function (IetfAttrValue $val) {
154
+				return $val->toASN1();
155
+			}, $this->_values);
156
+		$elements[] = new Sequence(...$values);
157
+		return new Sequence(...$elements);
158
+	}
159 159
     
160
-    /**
161
-     *
162
-     * @see \X501\ASN1\AttributeValue\AttributeValue::stringValue()
163
-     * @return string
164
-     */
165
-    public function stringValue(): string
166
-    {
167
-        return "#" . bin2hex($this->toASN1()->toDER());
168
-    }
160
+	/**
161
+	 *
162
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::stringValue()
163
+	 * @return string
164
+	 */
165
+	public function stringValue(): string
166
+	{
167
+		return "#" . bin2hex($this->toASN1()->toDER());
168
+	}
169 169
     
170
-    /**
171
-     *
172
-     * @see \X501\ASN1\AttributeValue\AttributeValue::equalityMatchingRule()
173
-     * @return BinaryMatch
174
-     */
175
-    public function equalityMatchingRule(): BinaryMatch
176
-    {
177
-        return new BinaryMatch();
178
-    }
170
+	/**
171
+	 *
172
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::equalityMatchingRule()
173
+	 * @return BinaryMatch
174
+	 */
175
+	public function equalityMatchingRule(): BinaryMatch
176
+	{
177
+		return new BinaryMatch();
178
+	}
179 179
     
180
-    /**
181
-     *
182
-     * @see \X501\ASN1\AttributeValue\AttributeValue::rfc2253String()
183
-     * @return string
184
-     */
185
-    public function rfc2253String(): string
186
-    {
187
-        return $this->stringValue();
188
-    }
180
+	/**
181
+	 *
182
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::rfc2253String()
183
+	 * @return string
184
+	 */
185
+	public function rfc2253String(): string
186
+	{
187
+		return $this->stringValue();
188
+	}
189 189
     
190
-    /**
191
-     *
192
-     * @see \X501\ASN1\AttributeValue\AttributeValue::_transcodedString()
193
-     * @return string
194
-     */
195
-    protected function _transcodedString(): string
196
-    {
197
-        return $this->stringValue();
198
-    }
190
+	/**
191
+	 *
192
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::_transcodedString()
193
+	 * @return string
194
+	 */
195
+	protected function _transcodedString(): string
196
+	{
197
+		return $this->stringValue();
198
+	}
199 199
     
200
-    /**
201
-     * Get number of values.
202
-     *
203
-     * @see \Countable::count()
204
-     * @return int
205
-     */
206
-    public function count(): int
207
-    {
208
-        return count($this->_values);
209
-    }
200
+	/**
201
+	 * Get number of values.
202
+	 *
203
+	 * @see \Countable::count()
204
+	 * @return int
205
+	 */
206
+	public function count(): int
207
+	{
208
+		return count($this->_values);
209
+	}
210 210
     
211
-    /**
212
-     * Get iterator for values.
213
-     *
214
-     * @see \IteratorAggregate::getIterator()
215
-     * @return \ArrayIterator
216
-     */
217
-    public function getIterator(): \ArrayIterator
218
-    {
219
-        return new \ArrayIterator($this->_values);
220
-    }
211
+	/**
212
+	 * Get iterator for values.
213
+	 *
214
+	 * @see \IteratorAggregate::getIterator()
215
+	 * @return \ArrayIterator
216
+	 */
217
+	public function getIterator(): \ArrayIterator
218
+	{
219
+		return new \ArrayIterator($this->_values);
220
+	}
221 221
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/NameConstraints/GeneralSubtrees.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -15,87 +15,87 @@
 block discarded – undo
15 15
  */
16 16
 class GeneralSubtrees implements \Countable, \IteratorAggregate
17 17
 {
18
-    /**
19
-     * Subtrees.
20
-     *
21
-     * @var GeneralSubtree[] $_subtrees
22
-     */
23
-    protected $_subtrees;
18
+	/**
19
+	 * Subtrees.
20
+	 *
21
+	 * @var GeneralSubtree[] $_subtrees
22
+	 */
23
+	protected $_subtrees;
24 24
     
25
-    /**
26
-     * Constructor.
27
-     *
28
-     * @param GeneralSubtree ...$subtrees
29
-     */
30
-    public function __construct(GeneralSubtree ...$subtrees)
31
-    {
32
-        $this->_subtrees = $subtrees;
33
-    }
25
+	/**
26
+	 * Constructor.
27
+	 *
28
+	 * @param GeneralSubtree ...$subtrees
29
+	 */
30
+	public function __construct(GeneralSubtree ...$subtrees)
31
+	{
32
+		$this->_subtrees = $subtrees;
33
+	}
34 34
     
35
-    /**
36
-     * Initialize from ASN.1.
37
-     *
38
-     * @param Sequence $seq
39
-     * @return self
40
-     */
41
-    public static function fromASN1(Sequence $seq): self
42
-    {
43
-        $subtrees = array_map(
44
-            function (UnspecifiedType $el) {
45
-                return GeneralSubtree::fromASN1($el->asSequence());
46
-            }, $seq->elements());
47
-        if (!count($subtrees)) {
48
-            throw new \UnexpectedValueException(
49
-                "GeneralSubtrees must contain at least one GeneralSubtree.");
50
-        }
51
-        return new self(...$subtrees);
52
-    }
35
+	/**
36
+	 * Initialize from ASN.1.
37
+	 *
38
+	 * @param Sequence $seq
39
+	 * @return self
40
+	 */
41
+	public static function fromASN1(Sequence $seq): self
42
+	{
43
+		$subtrees = array_map(
44
+			function (UnspecifiedType $el) {
45
+				return GeneralSubtree::fromASN1($el->asSequence());
46
+			}, $seq->elements());
47
+		if (!count($subtrees)) {
48
+			throw new \UnexpectedValueException(
49
+				"GeneralSubtrees must contain at least one GeneralSubtree.");
50
+		}
51
+		return new self(...$subtrees);
52
+	}
53 53
     
54
-    /**
55
-     * Get all subtrees.
56
-     *
57
-     * @return GeneralSubtree[]
58
-     */
59
-    public function all(): array
60
-    {
61
-        return $this->_subtrees;
62
-    }
54
+	/**
55
+	 * Get all subtrees.
56
+	 *
57
+	 * @return GeneralSubtree[]
58
+	 */
59
+	public function all(): array
60
+	{
61
+		return $this->_subtrees;
62
+	}
63 63
     
64
-    /**
65
-     * Generate ASN.1 structure.
66
-     *
67
-     * @return Sequence
68
-     */
69
-    public function toASN1(): Sequence
70
-    {
71
-        if (!count($this->_subtrees)) {
72
-            throw new \LogicException("No subtrees.");
73
-        }
74
-        $elements = array_map(
75
-            function (GeneralSubtree $gs) {
76
-                return $gs->toASN1();
77
-            }, $this->_subtrees);
78
-        return new Sequence(...$elements);
79
-    }
64
+	/**
65
+	 * Generate ASN.1 structure.
66
+	 *
67
+	 * @return Sequence
68
+	 */
69
+	public function toASN1(): Sequence
70
+	{
71
+		if (!count($this->_subtrees)) {
72
+			throw new \LogicException("No subtrees.");
73
+		}
74
+		$elements = array_map(
75
+			function (GeneralSubtree $gs) {
76
+				return $gs->toASN1();
77
+			}, $this->_subtrees);
78
+		return new Sequence(...$elements);
79
+	}
80 80
     
81
-    /**
82
-     *
83
-     * @see \Countable::count()
84
-     * @return int
85
-     */
86
-    public function count(): int
87
-    {
88
-        return count($this->_subtrees);
89
-    }
81
+	/**
82
+	 *
83
+	 * @see \Countable::count()
84
+	 * @return int
85
+	 */
86
+	public function count(): int
87
+	{
88
+		return count($this->_subtrees);
89
+	}
90 90
     
91
-    /**
92
-     * Get iterator for subtrees.
93
-     *
94
-     * @see \IteratorAggregate::getIterator()
95
-     * @return \ArrayIterator
96
-     */
97
-    public function getIterator(): \ArrayIterator
98
-    {
99
-        return new \ArrayIterator($this->_subtrees);
100
-    }
91
+	/**
92
+	 * Get iterator for subtrees.
93
+	 *
94
+	 * @see \IteratorAggregate::getIterator()
95
+	 * @return \ArrayIterator
96
+	 */
97
+	public function getIterator(): \ArrayIterator
98
+	{
99
+		return new \ArrayIterator($this->_subtrees);
100
+	}
101 101
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CRLDistributionPointsExtension.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -14,95 +14,95 @@
 block discarded – undo
14 14
  * @link https://tools.ietf.org/html/rfc5280#section-4.2.1.13
15 15
  */
16 16
 class CRLDistributionPointsExtension extends Extension implements 
17
-    \Countable,
18
-    \IteratorAggregate
17
+	\Countable,
18
+	\IteratorAggregate
19 19
 {
20
-    /**
21
-     * Distribution points.
22
-     *
23
-     * @var DistributionPoint[] $_distributionPoints
24
-     */
25
-    protected $_distributionPoints;
20
+	/**
21
+	 * Distribution points.
22
+	 *
23
+	 * @var DistributionPoint[] $_distributionPoints
24
+	 */
25
+	protected $_distributionPoints;
26 26
     
27
-    /**
28
-     * Constructor.
29
-     *
30
-     * @param bool $critical
31
-     * @param DistributionPoint ...$distribution_points
32
-     */
33
-    public function __construct(bool $critical,
34
-        DistributionPoint ...$distribution_points)
35
-    {
36
-        parent::__construct(self::OID_CRL_DISTRIBUTION_POINTS, $critical);
37
-        $this->_distributionPoints = $distribution_points;
38
-    }
27
+	/**
28
+	 * Constructor.
29
+	 *
30
+	 * @param bool $critical
31
+	 * @param DistributionPoint ...$distribution_points
32
+	 */
33
+	public function __construct(bool $critical,
34
+		DistributionPoint ...$distribution_points)
35
+	{
36
+		parent::__construct(self::OID_CRL_DISTRIBUTION_POINTS, $critical);
37
+		$this->_distributionPoints = $distribution_points;
38
+	}
39 39
     
40
-    /**
41
-     *
42
-     * {@inheritdoc}
43
-     * @return self
44
-     */
45
-    protected static function _fromDER(string $data, bool $critical): self
46
-    {
47
-        $dps = array_map(
48
-            function (UnspecifiedType $el) {
49
-                return DistributionPoint::fromASN1($el->asSequence());
50
-            }, Sequence::fromDER($data)->elements());
51
-        if (!count($dps)) {
52
-            throw new \UnexpectedValueException(
53
-                "CRLDistributionPoints must have" .
54
-                     " at least one DistributionPoint.");
55
-        }
56
-        // late static bound, extended by Freshest CRL extension
57
-        return new static($critical, ...$dps);
58
-    }
40
+	/**
41
+	 *
42
+	 * {@inheritdoc}
43
+	 * @return self
44
+	 */
45
+	protected static function _fromDER(string $data, bool $critical): self
46
+	{
47
+		$dps = array_map(
48
+			function (UnspecifiedType $el) {
49
+				return DistributionPoint::fromASN1($el->asSequence());
50
+			}, Sequence::fromDER($data)->elements());
51
+		if (!count($dps)) {
52
+			throw new \UnexpectedValueException(
53
+				"CRLDistributionPoints must have" .
54
+					 " at least one DistributionPoint.");
55
+		}
56
+		// late static bound, extended by Freshest CRL extension
57
+		return new static($critical, ...$dps);
58
+	}
59 59
     
60
-    /**
61
-     *
62
-     * {@inheritdoc}
63
-     * @return Sequence
64
-     */
65
-    protected function _valueASN1(): Sequence
66
-    {
67
-        if (!count($this->_distributionPoints)) {
68
-            throw new \LogicException("No distribution points.");
69
-        }
70
-        $elements = array_map(
71
-            function (DistributionPoint $dp) {
72
-                return $dp->toASN1();
73
-            }, $this->_distributionPoints);
74
-        return new Sequence(...$elements);
75
-    }
60
+	/**
61
+	 *
62
+	 * {@inheritdoc}
63
+	 * @return Sequence
64
+	 */
65
+	protected function _valueASN1(): Sequence
66
+	{
67
+		if (!count($this->_distributionPoints)) {
68
+			throw new \LogicException("No distribution points.");
69
+		}
70
+		$elements = array_map(
71
+			function (DistributionPoint $dp) {
72
+				return $dp->toASN1();
73
+			}, $this->_distributionPoints);
74
+		return new Sequence(...$elements);
75
+	}
76 76
     
77
-    /**
78
-     * Get distribution points.
79
-     *
80
-     * @return DistributionPoint[]
81
-     */
82
-    public function distributionPoints(): array
83
-    {
84
-        return $this->_distributionPoints;
85
-    }
77
+	/**
78
+	 * Get distribution points.
79
+	 *
80
+	 * @return DistributionPoint[]
81
+	 */
82
+	public function distributionPoints(): array
83
+	{
84
+		return $this->_distributionPoints;
85
+	}
86 86
     
87
-    /**
88
-     * Get the number of distribution points.
89
-     *
90
-     * @see \Countable::count()
91
-     * @return int
92
-     */
93
-    public function count(): int
94
-    {
95
-        return count($this->_distributionPoints);
96
-    }
87
+	/**
88
+	 * Get the number of distribution points.
89
+	 *
90
+	 * @see \Countable::count()
91
+	 * @return int
92
+	 */
93
+	public function count(): int
94
+	{
95
+		return count($this->_distributionPoints);
96
+	}
97 97
     
98
-    /**
99
-     * Get iterator for distribution points.
100
-     *
101
-     * @see \IteratorAggregate::getIterator()
102
-     * @return \ArrayIterator
103
-     */
104
-    public function getIterator(): \ArrayIterator
105
-    {
106
-        return new \ArrayIterator($this->_distributionPoints);
107
-    }
98
+	/**
99
+	 * Get iterator for distribution points.
100
+	 *
101
+	 * @see \IteratorAggregate::getIterator()
102
+	 * @return \ArrayIterator
103
+	 */
104
+	public function getIterator(): \ArrayIterator
105
+	{
106
+		return new \ArrayIterator($this->_distributionPoints);
107
+	}
108 108
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/TargetInformationExtension.php 1 patch
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -19,139 +19,139 @@
 block discarded – undo
19 19
  * @link https://tools.ietf.org/html/rfc5755#section-4.3.2
20 20
  */
21 21
 class TargetInformationExtension extends Extension implements 
22
-    \Countable,
23
-    \IteratorAggregate
22
+	\Countable,
23
+	\IteratorAggregate
24 24
 {
25
-    /**
26
-     * Targets elements.
27
-     *
28
-     * @var Targets[] $_targets
29
-     */
30
-    protected $_targets;
25
+	/**
26
+	 * Targets elements.
27
+	 *
28
+	 * @var Targets[] $_targets
29
+	 */
30
+	protected $_targets;
31 31
     
32
-    /**
33
-     * Targets[] merged to single Targets.
34
-     *
35
-     * @var Targets|null
36
-     */
37
-    private $_merged;
32
+	/**
33
+	 * Targets[] merged to single Targets.
34
+	 *
35
+	 * @var Targets|null
36
+	 */
37
+	private $_merged;
38 38
     
39
-    /**
40
-     * Constructor.
41
-     *
42
-     * @param bool $critical
43
-     * @param Targets ...$targets
44
-     */
45
-    public function __construct(bool $critical, Targets ...$targets)
46
-    {
47
-        parent::__construct(self::OID_TARGET_INFORMATION, $critical);
48
-        $this->_targets = $targets;
49
-    }
39
+	/**
40
+	 * Constructor.
41
+	 *
42
+	 * @param bool $critical
43
+	 * @param Targets ...$targets
44
+	 */
45
+	public function __construct(bool $critical, Targets ...$targets)
46
+	{
47
+		parent::__construct(self::OID_TARGET_INFORMATION, $critical);
48
+		$this->_targets = $targets;
49
+	}
50 50
     
51
-    /**
52
-     * Initialize from one or more Target objects.
53
-     *
54
-     * Extension criticality shall be set to true as specified by RFC 5755.
55
-     *
56
-     * @param Target ...$target
57
-     * @return TargetInformationExtension
58
-     */
59
-    public static function fromTargets(Target ...$target): self
60
-    {
61
-        return new self(true, new Targets(...$target));
62
-    }
51
+	/**
52
+	 * Initialize from one or more Target objects.
53
+	 *
54
+	 * Extension criticality shall be set to true as specified by RFC 5755.
55
+	 *
56
+	 * @param Target ...$target
57
+	 * @return TargetInformationExtension
58
+	 */
59
+	public static function fromTargets(Target ...$target): self
60
+	{
61
+		return new self(true, new Targets(...$target));
62
+	}
63 63
     
64
-    /**
65
-     * Reset internal state on clone.
66
-     */
67
-    public function __clone()
68
-    {
69
-        $this->_merged = null;
70
-    }
64
+	/**
65
+	 * Reset internal state on clone.
66
+	 */
67
+	public function __clone()
68
+	{
69
+		$this->_merged = null;
70
+	}
71 71
     
72
-    /**
73
-     *
74
-     * {@inheritdoc}
75
-     * @return self
76
-     */
77
-    protected static function _fromDER(string $data, bool $critical): self
78
-    {
79
-        $targets = array_map(
80
-            function (UnspecifiedType $el) {
81
-                return Targets::fromASN1($el->asSequence());
82
-            }, Sequence::fromDER($data)->elements());
83
-        return new self($critical, ...$targets);
84
-    }
72
+	/**
73
+	 *
74
+	 * {@inheritdoc}
75
+	 * @return self
76
+	 */
77
+	protected static function _fromDER(string $data, bool $critical): self
78
+	{
79
+		$targets = array_map(
80
+			function (UnspecifiedType $el) {
81
+				return Targets::fromASN1($el->asSequence());
82
+			}, Sequence::fromDER($data)->elements());
83
+		return new self($critical, ...$targets);
84
+	}
85 85
     
86
-    /**
87
-     * Get all targets.
88
-     *
89
-     * @return Targets
90
-     */
91
-    public function targets(): Targets
92
-    {
93
-        if (!isset($this->_merged)) {
94
-            $a = array();
95
-            foreach ($this->_targets as $targets) {
96
-                $a = array_merge($a, $targets->all());
97
-            }
98
-            $this->_merged = new Targets(...$a);
99
-        }
100
-        return $this->_merged;
101
-    }
86
+	/**
87
+	 * Get all targets.
88
+	 *
89
+	 * @return Targets
90
+	 */
91
+	public function targets(): Targets
92
+	{
93
+		if (!isset($this->_merged)) {
94
+			$a = array();
95
+			foreach ($this->_targets as $targets) {
96
+				$a = array_merge($a, $targets->all());
97
+			}
98
+			$this->_merged = new Targets(...$a);
99
+		}
100
+		return $this->_merged;
101
+	}
102 102
     
103
-    /**
104
-     * Get all name targets.
105
-     *
106
-     * @return Target[]
107
-     */
108
-    public function names(): array
109
-    {
110
-        return $this->targets()->nameTargets();
111
-    }
103
+	/**
104
+	 * Get all name targets.
105
+	 *
106
+	 * @return Target[]
107
+	 */
108
+	public function names(): array
109
+	{
110
+		return $this->targets()->nameTargets();
111
+	}
112 112
     
113
-    /**
114
-     * Get all group targets.
115
-     *
116
-     * @return Target[]
117
-     */
118
-    public function groups(): array
119
-    {
120
-        return $this->targets()->groupTargets();
121
-    }
113
+	/**
114
+	 * Get all group targets.
115
+	 *
116
+	 * @return Target[]
117
+	 */
118
+	public function groups(): array
119
+	{
120
+		return $this->targets()->groupTargets();
121
+	}
122 122
     
123
-    /**
124
-     *
125
-     * @see \X509\Certificate\Extension\Extension::_valueASN1()
126
-     * @return Sequence
127
-     */
128
-    protected function _valueASN1(): Sequence
129
-    {
130
-        $elements = array_map(
131
-            function (Targets $targets) {
132
-                return $targets->toASN1();
133
-            }, $this->_targets);
134
-        return new Sequence(...$elements);
135
-    }
123
+	/**
124
+	 *
125
+	 * @see \X509\Certificate\Extension\Extension::_valueASN1()
126
+	 * @return Sequence
127
+	 */
128
+	protected function _valueASN1(): Sequence
129
+	{
130
+		$elements = array_map(
131
+			function (Targets $targets) {
132
+				return $targets->toASN1();
133
+			}, $this->_targets);
134
+		return new Sequence(...$elements);
135
+	}
136 136
     
137
-    /**
138
-     *
139
-     * @see \Countable::count()
140
-     * @return int
141
-     */
142
-    public function count(): int
143
-    {
144
-        return count($this->targets());
145
-    }
137
+	/**
138
+	 *
139
+	 * @see \Countable::count()
140
+	 * @return int
141
+	 */
142
+	public function count(): int
143
+	{
144
+		return count($this->targets());
145
+	}
146 146
     
147
-    /**
148
-     * Get iterator for targets.
149
-     *
150
-     * @see \IteratorAggregate::getIterator()
151
-     * @return \ArrayIterator
152
-     */
153
-    public function getIterator(): \ArrayIterator
154
-    {
155
-        return new \ArrayIterator($this->targets()->all());
156
-    }
147
+	/**
148
+	 * Get iterator for targets.
149
+	 *
150
+	 * @see \IteratorAggregate::getIterator()
151
+	 * @return \ArrayIterator
152
+	 */
153
+	public function getIterator(): \ArrayIterator
154
+	{
155
+		return new \ArrayIterator($this->targets()->all());
156
+	}
157 157
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php 1 patch
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -16,207 +16,207 @@
 block discarded – undo
16 16
  */
17 17
 class PolicyInformation implements \Countable, \IteratorAggregate
18 18
 {
19
-    /**
20
-     * Wildcard policy.
21
-     *
22
-     * @var string
23
-     */
24
-    const OID_ANY_POLICY = "2.5.29.32.0";
25
-    
26
-    /**
27
-     * Policy identifier.
28
-     *
29
-     * @var string $_oid
30
-     */
31
-    protected $_oid;
32
-    
33
-    /**
34
-     * Policy qualifiers.
35
-     *
36
-     * @var PolicyQualifierInfo[] $_qualifiers
37
-     */
38
-    protected $_qualifiers;
39
-    
40
-    /**
41
-     * Constructor.
42
-     *
43
-     * @param string $oid
44
-     * @param PolicyQualifierInfo ...$qualifiers
45
-     */
46
-    public function __construct(string $oid, PolicyQualifierInfo ...$qualifiers)
47
-    {
48
-        $this->_oid = $oid;
49
-        $this->_qualifiers = array();
50
-        foreach ($qualifiers as $qual) {
51
-            $this->_qualifiers[$qual->oid()] = $qual;
52
-        }
53
-    }
54
-    
55
-    /**
56
-     * Initialize from ASN.1.
57
-     *
58
-     * @param Sequence $seq
59
-     * @return self
60
-     */
61
-    public static function fromASN1(Sequence $seq): self
62
-    {
63
-        $oid = $seq->at(0)
64
-            ->asObjectIdentifier()
65
-            ->oid();
66
-        $qualifiers = array();
67
-        if (count($seq) > 1) {
68
-            $qualifiers = array_map(
69
-                function (UnspecifiedType $el) {
70
-                    return PolicyQualifierInfo::fromASN1($el->asSequence());
71
-                },
72
-                $seq->at(1)
73
-                    ->asSequence()
74
-                    ->elements());
75
-        }
76
-        return new self($oid, ...$qualifiers);
77
-    }
78
-    
79
-    /**
80
-     * Get policy identifier.
81
-     *
82
-     * @return string
83
-     */
84
-    public function oid(): string
85
-    {
86
-        return $this->_oid;
87
-    }
88
-    
89
-    /**
90
-     * Check whether this policy is anyPolicy.
91
-     *
92
-     * @return bool
93
-     */
94
-    public function isAnyPolicy(): bool
95
-    {
96
-        return self::OID_ANY_POLICY === $this->_oid;
97
-    }
98
-    
99
-    /**
100
-     * Get policy qualifiers.
101
-     *
102
-     * @return PolicyQualifierInfo[]
103
-     */
104
-    public function qualifiers(): array
105
-    {
106
-        return array_values($this->_qualifiers);
107
-    }
108
-    
109
-    /**
110
-     * Check whether qualifier is present.
111
-     *
112
-     * @param string $oid
113
-     * @return boolean
114
-     */
115
-    public function has(string $oid): bool
116
-    {
117
-        return isset($this->_qualifiers[$oid]);
118
-    }
119
-    
120
-    /**
121
-     * Get qualifier by OID.
122
-     *
123
-     * @param string $oid
124
-     * @throws \OutOfBoundsException
125
-     * @return PolicyQualifierInfo
126
-     */
127
-    public function get(string $oid): PolicyQualifierInfo
128
-    {
129
-        if (!$this->has($oid)) {
130
-            throw new \LogicException("No $oid qualifier.");
131
-        }
132
-        return $this->_qualifiers[$oid];
133
-    }
134
-    
135
-    /**
136
-     * Check whether CPS qualifier is present.
137
-     *
138
-     * @return bool
139
-     */
140
-    public function hasCPSQualifier(): bool
141
-    {
142
-        return $this->has(PolicyQualifierInfo::OID_CPS);
143
-    }
144
-    
145
-    /**
146
-     * Get CPS qualifier.
147
-     *
148
-     * @throws \LogicException
149
-     * @return CPSQualifier
150
-     */
151
-    public function CPSQualifier(): CPSQualifier
152
-    {
153
-        if (!$this->hasCPSQualifier()) {
154
-            throw new \LogicException("CPS qualifier not set.");
155
-        }
156
-        return $this->get(PolicyQualifierInfo::OID_CPS);
157
-    }
158
-    
159
-    /**
160
-     * Check whether user notice qualifier is present.
161
-     *
162
-     * @return bool
163
-     */
164
-    public function hasUserNoticeQualifier(): bool
165
-    {
166
-        return $this->has(PolicyQualifierInfo::OID_UNOTICE);
167
-    }
168
-    
169
-    /**
170
-     * Get user notice qualifier.
171
-     *
172
-     * @throws \LogicException
173
-     * @return UserNoticeQualifier
174
-     */
175
-    public function userNoticeQualifier(): UserNoticeQualifier
176
-    {
177
-        if (!$this->hasUserNoticeQualifier()) {
178
-            throw new \LogicException("User notice qualifier not set.");
179
-        }
180
-        return $this->get(PolicyQualifierInfo::OID_UNOTICE);
181
-    }
182
-    
183
-    /**
184
-     * Get ASN.1 structure.
185
-     *
186
-     * @return Sequence
187
-     */
188
-    public function toASN1(): Sequence
189
-    {
190
-        $elements = array(new ObjectIdentifier($this->_oid));
191
-        if (count($this->_qualifiers)) {
192
-            $qualifiers = array_map(
193
-                function (PolicyQualifierInfo $pqi) {
194
-                    return $pqi->toASN1();
195
-                }, array_values($this->_qualifiers));
196
-            $elements[] = new Sequence(...$qualifiers);
197
-        }
198
-        return new Sequence(...$elements);
199
-    }
200
-    
201
-    /**
202
-     * Get number of qualifiers.
203
-     *
204
-     * @see \Countable::count()
205
-     * @return int
206
-     */
207
-    public function count(): int
208
-    {
209
-        return count($this->_qualifiers);
210
-    }
211
-    
212
-    /**
213
-     * Get iterator for qualifiers.
214
-     *
215
-     * @see \IteratorAggregate::getIterator()
216
-     * @return \ArrayIterator
217
-     */
218
-    public function getIterator(): \ArrayIterator
219
-    {
220
-        return new \ArrayIterator($this->_qualifiers);
221
-    }
19
+	/**
20
+	 * Wildcard policy.
21
+	 *
22
+	 * @var string
23
+	 */
24
+	const OID_ANY_POLICY = "2.5.29.32.0";
25
+    
26
+	/**
27
+	 * Policy identifier.
28
+	 *
29
+	 * @var string $_oid
30
+	 */
31
+	protected $_oid;
32
+    
33
+	/**
34
+	 * Policy qualifiers.
35
+	 *
36
+	 * @var PolicyQualifierInfo[] $_qualifiers
37
+	 */
38
+	protected $_qualifiers;
39
+    
40
+	/**
41
+	 * Constructor.
42
+	 *
43
+	 * @param string $oid
44
+	 * @param PolicyQualifierInfo ...$qualifiers
45
+	 */
46
+	public function __construct(string $oid, PolicyQualifierInfo ...$qualifiers)
47
+	{
48
+		$this->_oid = $oid;
49
+		$this->_qualifiers = array();
50
+		foreach ($qualifiers as $qual) {
51
+			$this->_qualifiers[$qual->oid()] = $qual;
52
+		}
53
+	}
54
+    
55
+	/**
56
+	 * Initialize from ASN.1.
57
+	 *
58
+	 * @param Sequence $seq
59
+	 * @return self
60
+	 */
61
+	public static function fromASN1(Sequence $seq): self
62
+	{
63
+		$oid = $seq->at(0)
64
+			->asObjectIdentifier()
65
+			->oid();
66
+		$qualifiers = array();
67
+		if (count($seq) > 1) {
68
+			$qualifiers = array_map(
69
+				function (UnspecifiedType $el) {
70
+					return PolicyQualifierInfo::fromASN1($el->asSequence());
71
+				},
72
+				$seq->at(1)
73
+					->asSequence()
74
+					->elements());
75
+		}
76
+		return new self($oid, ...$qualifiers);
77
+	}
78
+    
79
+	/**
80
+	 * Get policy identifier.
81
+	 *
82
+	 * @return string
83
+	 */
84
+	public function oid(): string
85
+	{
86
+		return $this->_oid;
87
+	}
88
+    
89
+	/**
90
+	 * Check whether this policy is anyPolicy.
91
+	 *
92
+	 * @return bool
93
+	 */
94
+	public function isAnyPolicy(): bool
95
+	{
96
+		return self::OID_ANY_POLICY === $this->_oid;
97
+	}
98
+    
99
+	/**
100
+	 * Get policy qualifiers.
101
+	 *
102
+	 * @return PolicyQualifierInfo[]
103
+	 */
104
+	public function qualifiers(): array
105
+	{
106
+		return array_values($this->_qualifiers);
107
+	}
108
+    
109
+	/**
110
+	 * Check whether qualifier is present.
111
+	 *
112
+	 * @param string $oid
113
+	 * @return boolean
114
+	 */
115
+	public function has(string $oid): bool
116
+	{
117
+		return isset($this->_qualifiers[$oid]);
118
+	}
119
+    
120
+	/**
121
+	 * Get qualifier by OID.
122
+	 *
123
+	 * @param string $oid
124
+	 * @throws \OutOfBoundsException
125
+	 * @return PolicyQualifierInfo
126
+	 */
127
+	public function get(string $oid): PolicyQualifierInfo
128
+	{
129
+		if (!$this->has($oid)) {
130
+			throw new \LogicException("No $oid qualifier.");
131
+		}
132
+		return $this->_qualifiers[$oid];
133
+	}
134
+    
135
+	/**
136
+	 * Check whether CPS qualifier is present.
137
+	 *
138
+	 * @return bool
139
+	 */
140
+	public function hasCPSQualifier(): bool
141
+	{
142
+		return $this->has(PolicyQualifierInfo::OID_CPS);
143
+	}
144
+    
145
+	/**
146
+	 * Get CPS qualifier.
147
+	 *
148
+	 * @throws \LogicException
149
+	 * @return CPSQualifier
150
+	 */
151
+	public function CPSQualifier(): CPSQualifier
152
+	{
153
+		if (!$this->hasCPSQualifier()) {
154
+			throw new \LogicException("CPS qualifier not set.");
155
+		}
156
+		return $this->get(PolicyQualifierInfo::OID_CPS);
157
+	}
158
+    
159
+	/**
160
+	 * Check whether user notice qualifier is present.
161
+	 *
162
+	 * @return bool
163
+	 */
164
+	public function hasUserNoticeQualifier(): bool
165
+	{
166
+		return $this->has(PolicyQualifierInfo::OID_UNOTICE);
167
+	}
168
+    
169
+	/**
170
+	 * Get user notice qualifier.
171
+	 *
172
+	 * @throws \LogicException
173
+	 * @return UserNoticeQualifier
174
+	 */
175
+	public function userNoticeQualifier(): UserNoticeQualifier
176
+	{
177
+		if (!$this->hasUserNoticeQualifier()) {
178
+			throw new \LogicException("User notice qualifier not set.");
179
+		}
180
+		return $this->get(PolicyQualifierInfo::OID_UNOTICE);
181
+	}
182
+    
183
+	/**
184
+	 * Get ASN.1 structure.
185
+	 *
186
+	 * @return Sequence
187
+	 */
188
+	public function toASN1(): Sequence
189
+	{
190
+		$elements = array(new ObjectIdentifier($this->_oid));
191
+		if (count($this->_qualifiers)) {
192
+			$qualifiers = array_map(
193
+				function (PolicyQualifierInfo $pqi) {
194
+					return $pqi->toASN1();
195
+				}, array_values($this->_qualifiers));
196
+			$elements[] = new Sequence(...$qualifiers);
197
+		}
198
+		return new Sequence(...$elements);
199
+	}
200
+    
201
+	/**
202
+	 * Get number of qualifiers.
203
+	 *
204
+	 * @see \Countable::count()
205
+	 * @return int
206
+	 */
207
+	public function count(): int
208
+	{
209
+		return count($this->_qualifiers);
210
+	}
211
+    
212
+	/**
213
+	 * Get iterator for qualifiers.
214
+	 *
215
+	 * @see \IteratorAggregate::getIterator()
216
+	 * @return \ArrayIterator
217
+	 */
218
+	public function getIterator(): \ArrayIterator
219
+	{
220
+		return new \ArrayIterator($this->_qualifiers);
221
+	}
222 222
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/NoticeReference.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -16,83 +16,83 @@
 block discarded – undo
16 16
  */
17 17
 class NoticeReference
18 18
 {
19
-    /**
20
-     * Organization.
21
-     *
22
-     * @var DisplayText $_organization
23
-     */
24
-    protected $_organization;
19
+	/**
20
+	 * Organization.
21
+	 *
22
+	 * @var DisplayText $_organization
23
+	 */
24
+	protected $_organization;
25 25
     
26
-    /**
27
-     * Notification reference numbers.
28
-     *
29
-     * @var int[] $_numbers
30
-     */
31
-    protected $_numbers;
26
+	/**
27
+	 * Notification reference numbers.
28
+	 *
29
+	 * @var int[] $_numbers
30
+	 */
31
+	protected $_numbers;
32 32
     
33
-    /**
34
-     * Constructor.
35
-     *
36
-     * @param DisplayText $organization
37
-     * @param int ...$numbers
38
-     */
39
-    public function __construct(DisplayText $organization, int ...$numbers)
40
-    {
41
-        $this->_organization = $organization;
42
-        $this->_numbers = $numbers;
43
-    }
33
+	/**
34
+	 * Constructor.
35
+	 *
36
+	 * @param DisplayText $organization
37
+	 * @param int ...$numbers
38
+	 */
39
+	public function __construct(DisplayText $organization, int ...$numbers)
40
+	{
41
+		$this->_organization = $organization;
42
+		$this->_numbers = $numbers;
43
+	}
44 44
     
45
-    /**
46
-     * Initialize from ASN.1.
47
-     *
48
-     * @param Sequence $seq
49
-     * @return self
50
-     */
51
-    public static function fromASN1(Sequence $seq): self
52
-    {
53
-        $org = DisplayText::fromASN1($seq->at(0)->asString());
54
-        $numbers = array_map(
55
-            function (UnspecifiedType $el) {
56
-                return $el->asInteger()->intNumber();
57
-            },
58
-            $seq->at(1)
59
-                ->asSequence()
60
-                ->elements());
61
-        return new self($org, ...$numbers);
62
-    }
45
+	/**
46
+	 * Initialize from ASN.1.
47
+	 *
48
+	 * @param Sequence $seq
49
+	 * @return self
50
+	 */
51
+	public static function fromASN1(Sequence $seq): self
52
+	{
53
+		$org = DisplayText::fromASN1($seq->at(0)->asString());
54
+		$numbers = array_map(
55
+			function (UnspecifiedType $el) {
56
+				return $el->asInteger()->intNumber();
57
+			},
58
+			$seq->at(1)
59
+				->asSequence()
60
+				->elements());
61
+		return new self($org, ...$numbers);
62
+	}
63 63
     
64
-    /**
65
-     * Get reference organization.
66
-     *
67
-     * @return DisplayText
68
-     */
69
-    public function organization(): DisplayText
70
-    {
71
-        return $this->_organization;
72
-    }
64
+	/**
65
+	 * Get reference organization.
66
+	 *
67
+	 * @return DisplayText
68
+	 */
69
+	public function organization(): DisplayText
70
+	{
71
+		return $this->_organization;
72
+	}
73 73
     
74
-    /**
75
-     * Get reference numbers.
76
-     *
77
-     * @return int[]
78
-     */
79
-    public function numbers(): array
80
-    {
81
-        return $this->_numbers;
82
-    }
74
+	/**
75
+	 * Get reference numbers.
76
+	 *
77
+	 * @return int[]
78
+	 */
79
+	public function numbers(): array
80
+	{
81
+		return $this->_numbers;
82
+	}
83 83
     
84
-    /**
85
-     * Generate ASN.1 structure.
86
-     *
87
-     * @return Sequence
88
-     */
89
-    public function toASN1(): Sequence
90
-    {
91
-        $org = $this->_organization->toASN1();
92
-        $nums = array_map(
93
-            function ($number) {
94
-                return new Integer($number);
95
-            }, $this->_numbers);
96
-        return new Sequence($org, new Sequence(...$nums));
97
-    }
84
+	/**
85
+	 * Generate ASN.1 structure.
86
+	 *
87
+	 * @return Sequence
88
+	 */
89
+	public function toASN1(): Sequence
90
+	{
91
+		$org = $this->_organization->toASN1();
92
+		$nums = array_map(
93
+			function ($number) {
94
+				return new Integer($number);
95
+			}, $this->_numbers);
96
+		return new Sequence($org, new Sequence(...$nums));
97
+	}
98 98
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/PolicyMappingsExtension.php 1 patch
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(string $data, bool $critical): self
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(string $data, bool $critical): self
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.