GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 584877...f7ba31 )
by Joni
05:42
created
lib/X509/Certificate/Extension/Target/Targets.php 2 patches
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -14,131 +14,131 @@
 block discarded – undo
14 14
  */
15 15
 class Targets implements \Countable, \IteratorAggregate
16 16
 {
17
-    /**
18
-     * Target elements.
19
-     *
20
-     * @var Target[] $_targets
21
-     */
22
-    protected $_targets;
17
+	/**
18
+	 * Target elements.
19
+	 *
20
+	 * @var Target[] $_targets
21
+	 */
22
+	protected $_targets;
23 23
     
24
-    /**
25
-     * Constructor.
26
-     *
27
-     * @param Target ...$targets
28
-     */
29
-    public function __construct(Target ...$targets)
30
-    {
31
-        $this->_targets = $targets;
32
-    }
24
+	/**
25
+	 * Constructor.
26
+	 *
27
+	 * @param Target ...$targets
28
+	 */
29
+	public function __construct(Target ...$targets)
30
+	{
31
+		$this->_targets = $targets;
32
+	}
33 33
     
34
-    /**
35
-     * Initialize from ASN.1.
36
-     *
37
-     * @param Sequence $seq
38
-     * @return self
39
-     */
40
-    public static function fromASN1(Sequence $seq): self
41
-    {
42
-        $targets = array_map(
43
-            function (UnspecifiedType $el) {
44
-                return Target::fromASN1($el->asTagged());
45
-            }, $seq->elements());
46
-        return new self(...$targets);
47
-    }
34
+	/**
35
+	 * Initialize from ASN.1.
36
+	 *
37
+	 * @param Sequence $seq
38
+	 * @return self
39
+	 */
40
+	public static function fromASN1(Sequence $seq): self
41
+	{
42
+		$targets = array_map(
43
+			function (UnspecifiedType $el) {
44
+				return Target::fromASN1($el->asTagged());
45
+			}, $seq->elements());
46
+		return new self(...$targets);
47
+	}
48 48
     
49
-    /**
50
-     * Get all targets.
51
-     *
52
-     * @return Target[]
53
-     */
54
-    public function all(): array
55
-    {
56
-        return $this->_targets;
57
-    }
49
+	/**
50
+	 * Get all targets.
51
+	 *
52
+	 * @return Target[]
53
+	 */
54
+	public function all(): array
55
+	{
56
+		return $this->_targets;
57
+	}
58 58
     
59
-    /**
60
-     * Get all targets of given type.
61
-     *
62
-     * @param int $type
63
-     * @return Target[]
64
-     */
65
-    protected function _allOfType(int $type): array
66
-    {
67
-        return array_values(
68
-            array_filter($this->_targets,
69
-                function (Target $target) use ($type) {
70
-                    return $target->type() == $type;
71
-                }));
72
-    }
59
+	/**
60
+	 * Get all targets of given type.
61
+	 *
62
+	 * @param int $type
63
+	 * @return Target[]
64
+	 */
65
+	protected function _allOfType(int $type): array
66
+	{
67
+		return array_values(
68
+			array_filter($this->_targets,
69
+				function (Target $target) use ($type) {
70
+					return $target->type() == $type;
71
+				}));
72
+	}
73 73
     
74
-    /**
75
-     * Get all name targets.
76
-     *
77
-     * @return Target[]
78
-     */
79
-    public function nameTargets(): array
80
-    {
81
-        return $this->_allOfType(Target::TYPE_NAME);
82
-    }
74
+	/**
75
+	 * Get all name targets.
76
+	 *
77
+	 * @return Target[]
78
+	 */
79
+	public function nameTargets(): array
80
+	{
81
+		return $this->_allOfType(Target::TYPE_NAME);
82
+	}
83 83
     
84
-    /**
85
-     * Get all group targets.
86
-     *
87
-     * @return Target[]
88
-     */
89
-    public function groupTargets(): array
90
-    {
91
-        return $this->_allOfType(Target::TYPE_GROUP);
92
-    }
84
+	/**
85
+	 * Get all group targets.
86
+	 *
87
+	 * @return Target[]
88
+	 */
89
+	public function groupTargets(): array
90
+	{
91
+		return $this->_allOfType(Target::TYPE_GROUP);
92
+	}
93 93
     
94
-    /**
95
-     * Check whether given target is present.
96
-     *
97
-     * @param Target $target
98
-     * @return boolean
99
-     */
100
-    public function hasTarget(Target $target): bool
101
-    {
102
-        foreach ($this->_allOfType($target->type()) as $t) {
103
-            if ($target->equals($t)) {
104
-                return true;
105
-            }
106
-        }
107
-        return false;
108
-    }
94
+	/**
95
+	 * Check whether given target is present.
96
+	 *
97
+	 * @param Target $target
98
+	 * @return boolean
99
+	 */
100
+	public function hasTarget(Target $target): bool
101
+	{
102
+		foreach ($this->_allOfType($target->type()) as $t) {
103
+			if ($target->equals($t)) {
104
+				return true;
105
+			}
106
+		}
107
+		return false;
108
+	}
109 109
     
110
-    /**
111
-     * Generate ASN.1 structure.
112
-     *
113
-     * @return Sequence
114
-     */
115
-    public function toASN1(): Sequence
116
-    {
117
-        $elements = array_map(
118
-            function (Target $target) {
119
-                return $target->toASN1();
120
-            }, $this->_targets);
121
-        return new Sequence(...$elements);
122
-    }
110
+	/**
111
+	 * Generate ASN.1 structure.
112
+	 *
113
+	 * @return Sequence
114
+	 */
115
+	public function toASN1(): Sequence
116
+	{
117
+		$elements = array_map(
118
+			function (Target $target) {
119
+				return $target->toASN1();
120
+			}, $this->_targets);
121
+		return new Sequence(...$elements);
122
+	}
123 123
     
124
-    /**
125
-     *
126
-     * @see \Countable::count()
127
-     * @return int
128
-     */
129
-    public function count(): int
130
-    {
131
-        return count($this->_targets);
132
-    }
124
+	/**
125
+	 *
126
+	 * @see \Countable::count()
127
+	 * @return int
128
+	 */
129
+	public function count(): int
130
+	{
131
+		return count($this->_targets);
132
+	}
133 133
     
134
-    /**
135
-     * Get iterator for targets.
136
-     *
137
-     * @see \IteratorAggregate::getIterator()
138
-     * @return \ArrayIterator
139
-     */
140
-    public function getIterator(): \ArrayIterator
141
-    {
142
-        return new \ArrayIterator($this->_targets);
143
-    }
134
+	/**
135
+	 * Get iterator for targets.
136
+	 *
137
+	 * @see \IteratorAggregate::getIterator()
138
+	 * @return \ArrayIterator
139
+	 */
140
+	public function getIterator(): \ArrayIterator
141
+	{
142
+		return new \ArrayIterator($this->_targets);
143
+	}
144 144
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public static function fromASN1(Sequence $seq): self
41 41
     {
42 42
         $targets = array_map(
43
-            function (UnspecifiedType $el) {
43
+            function(UnspecifiedType $el) {
44 44
                 return Target::fromASN1($el->asTagged());
45 45
             }, $seq->elements());
46 46
         return new self(...$targets);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     {
67 67
         return array_values(
68 68
             array_filter($this->_targets,
69
-                function (Target $target) use ($type) {
69
+                function(Target $target) use ($type) {
70 70
                     return $target->type() == $type;
71 71
                 }));
72 72
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function toASN1(): Sequence
116 116
     {
117 117
         $elements = array_map(
118
-            function (Target $target) {
118
+            function(Target $target) {
119 119
                 return $target->toASN1();
120 120
             }, $this->_targets);
121 121
         return new Sequence(...$elements);
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/Target/Target.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -13,89 +13,89 @@
 block discarded – undo
13 13
  */
14 14
 abstract class Target
15 15
 {
16
-    const TYPE_NAME = 0;
17
-    const TYPE_GROUP = 1;
18
-    const TYPE_CERT = 2;
16
+	const TYPE_NAME = 0;
17
+	const TYPE_GROUP = 1;
18
+	const TYPE_CERT = 2;
19 19
     
20
-    /**
21
-     * Type tag.
22
-     *
23
-     * @var int $_type
24
-     */
25
-    protected $_type;
20
+	/**
21
+	 * Type tag.
22
+	 *
23
+	 * @var int $_type
24
+	 */
25
+	protected $_type;
26 26
     
27
-    /**
28
-     * Generate ASN.1 element.
29
-     *
30
-     * @return \ASN1\Element
31
-     */
32
-    abstract public function toASN1();
27
+	/**
28
+	 * Generate ASN.1 element.
29
+	 *
30
+	 * @return \ASN1\Element
31
+	 */
32
+	abstract public function toASN1();
33 33
     
34
-    /**
35
-     * Get string value of the target.
36
-     *
37
-     * @return string
38
-     */
39
-    abstract public function string(): string;
34
+	/**
35
+	 * Get string value of the target.
36
+	 *
37
+	 * @return string
38
+	 */
39
+	abstract public function string(): string;
40 40
     
41
-    /**
42
-     * Initialize concrete object from the chosen ASN.1 element.
43
-     *
44
-     * @param TaggedType $el
45
-     * @return self
46
-     */
47
-    public static function fromChosenASN1(TaggedType $el)
48
-    {
49
-        throw new \BadMethodCallException(
50
-            __FUNCTION__ . " must be implemented in the derived class.");
51
-    }
41
+	/**
42
+	 * Initialize concrete object from the chosen ASN.1 element.
43
+	 *
44
+	 * @param TaggedType $el
45
+	 * @return self
46
+	 */
47
+	public static function fromChosenASN1(TaggedType $el)
48
+	{
49
+		throw new \BadMethodCallException(
50
+			__FUNCTION__ . " must be implemented in the derived class.");
51
+	}
52 52
     
53
-    /**
54
-     * Parse from ASN.1.
55
-     *
56
-     * @param TaggedType $el
57
-     * @throws \UnexpectedValueException
58
-     * @return self
59
-     */
60
-    public static function fromASN1(TaggedType $el): self
61
-    {
62
-        switch ($el->tag()) {
63
-            case self::TYPE_NAME:
64
-                return TargetName::fromChosenASN1($el->asExplicit()->asTagged());
65
-            case self::TYPE_GROUP:
66
-                return TargetGroup::fromChosenASN1(
67
-                    $el->asExplicit()->asTagged());
68
-            case self::TYPE_CERT:
69
-                throw new \RuntimeException("targetCert not supported.");
70
-        }
71
-        throw new \UnexpectedValueException(
72
-            "Target type " . $el->tag() . " not supported.");
73
-    }
53
+	/**
54
+	 * Parse from ASN.1.
55
+	 *
56
+	 * @param TaggedType $el
57
+	 * @throws \UnexpectedValueException
58
+	 * @return self
59
+	 */
60
+	public static function fromASN1(TaggedType $el): self
61
+	{
62
+		switch ($el->tag()) {
63
+			case self::TYPE_NAME:
64
+				return TargetName::fromChosenASN1($el->asExplicit()->asTagged());
65
+			case self::TYPE_GROUP:
66
+				return TargetGroup::fromChosenASN1(
67
+					$el->asExplicit()->asTagged());
68
+			case self::TYPE_CERT:
69
+				throw new \RuntimeException("targetCert not supported.");
70
+		}
71
+		throw new \UnexpectedValueException(
72
+			"Target type " . $el->tag() . " not supported.");
73
+	}
74 74
     
75
-    /**
76
-     * Get type tag.
77
-     *
78
-     * @return int
79
-     */
80
-    public function type(): int
81
-    {
82
-        return $this->_type;
83
-    }
75
+	/**
76
+	 * Get type tag.
77
+	 *
78
+	 * @return int
79
+	 */
80
+	public function type(): int
81
+	{
82
+		return $this->_type;
83
+	}
84 84
     
85
-    /**
86
-     * Check whether target is equal to another.
87
-     *
88
-     * @param Target $other
89
-     * @return bool
90
-     */
91
-    public function equals(Target $other): bool
92
-    {
93
-        if ($this->_type != $other->_type) {
94
-            return false;
95
-        }
96
-        if ($this->toASN1()->toDER() != $other->toASN1()->toDER()) {
97
-            return false;
98
-        }
99
-        return true;
100
-    }
85
+	/**
86
+	 * Check whether target is equal to another.
87
+	 *
88
+	 * @param Target $other
89
+	 * @return bool
90
+	 */
91
+	public function equals(Target $other): bool
92
+	{
93
+		if ($this->_type != $other->_type) {
94
+			return false;
95
+		}
96
+		if ($this->toASN1()->toDER() != $other->toASN1()->toDER()) {
97
+			return false;
98
+		}
99
+		return true;
100
+	}
101 101
 }
Please login to merge, or discard this patch.
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,13 +60,13 @@
 block discarded – undo
60 60
     public static function fromASN1(TaggedType $el): self
61 61
     {
62 62
         switch ($el->tag()) {
63
-            case self::TYPE_NAME:
64
-                return TargetName::fromChosenASN1($el->asExplicit()->asTagged());
65
-            case self::TYPE_GROUP:
66
-                return TargetGroup::fromChosenASN1(
67
-                    $el->asExplicit()->asTagged());
68
-            case self::TYPE_CERT:
69
-                throw new \RuntimeException("targetCert not supported.");
63
+        case self::TYPE_NAME:
64
+            return TargetName::fromChosenASN1($el->asExplicit()->asTagged());
65
+        case self::TYPE_GROUP:
66
+            return TargetGroup::fromChosenASN1(
67
+                $el->asExplicit()->asTagged());
68
+        case self::TYPE_CERT:
69
+            throw new \RuntimeException("targetCert not supported.");
70 70
         }
71 71
         throw new \UnexpectedValueException(
72 72
             "Target type " . $el->tag() . " not supported.");
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/Target/TargetName.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -15,60 +15,60 @@
 block discarded – undo
15 15
  */
16 16
 class TargetName extends Target
17 17
 {
18
-    /**
19
-     * Name.
20
-     *
21
-     * @var GeneralName $_name
22
-     */
23
-    protected $_name;
18
+	/**
19
+	 * Name.
20
+	 *
21
+	 * @var GeneralName $_name
22
+	 */
23
+	protected $_name;
24 24
     
25
-    /**
26
-     * Constructor.
27
-     *
28
-     * @param GeneralName $name
29
-     */
30
-    public function __construct(GeneralName $name)
31
-    {
32
-        $this->_name = $name;
33
-        $this->_type = self::TYPE_NAME;
34
-    }
25
+	/**
26
+	 * Constructor.
27
+	 *
28
+	 * @param GeneralName $name
29
+	 */
30
+	public function __construct(GeneralName $name)
31
+	{
32
+		$this->_name = $name;
33
+		$this->_type = self::TYPE_NAME;
34
+	}
35 35
     
36
-    /**
37
-     *
38
-     * @param TaggedType $el
39
-     * @return self
40
-     */
41
-    public static function fromChosenASN1(TaggedType $el): self
42
-    {
43
-        return new self(GeneralName::fromASN1($el));
44
-    }
36
+	/**
37
+	 *
38
+	 * @param TaggedType $el
39
+	 * @return self
40
+	 */
41
+	public static function fromChosenASN1(TaggedType $el): self
42
+	{
43
+		return new self(GeneralName::fromASN1($el));
44
+	}
45 45
     
46
-    /**
47
-     *
48
-     * {@inheritdoc}
49
-     */
50
-    public function string(): string
51
-    {
52
-        return $this->_name->string();
53
-    }
46
+	/**
47
+	 *
48
+	 * {@inheritdoc}
49
+	 */
50
+	public function string(): string
51
+	{
52
+		return $this->_name->string();
53
+	}
54 54
     
55
-    /**
56
-     * Get name.
57
-     *
58
-     * @return GeneralName
59
-     */
60
-    public function name(): GeneralName
61
-    {
62
-        return $this->_name;
63
-    }
55
+	/**
56
+	 * Get name.
57
+	 *
58
+	 * @return GeneralName
59
+	 */
60
+	public function name(): GeneralName
61
+	{
62
+		return $this->_name;
63
+	}
64 64
     
65
-    /**
66
-     *
67
-     * {@inheritdoc}
68
-     * @return ExplicitlyTaggedType
69
-     */
70
-    public function toASN1(): TaggedType
71
-    {
72
-        return new ExplicitlyTaggedType($this->_type, $this->_name->toASN1());
73
-    }
65
+	/**
66
+	 *
67
+	 * {@inheritdoc}
68
+	 * @return ExplicitlyTaggedType
69
+	 */
70
+	public function toASN1(): TaggedType
71
+	{
72
+		return new ExplicitlyTaggedType($this->_type, $this->_name->toASN1());
73
+	}
74 74
 }
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/DisplayText.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -19,93 +19,93 @@
 block discarded – undo
19 19
  */
20 20
 class DisplayText
21 21
 {
22
-    /**
23
-     * Text.
24
-     *
25
-     * @var string $_text
26
-     */
27
-    protected $_text;
22
+	/**
23
+	 * Text.
24
+	 *
25
+	 * @var string $_text
26
+	 */
27
+	protected $_text;
28 28
     
29
-    /**
30
-     * Element tag.
31
-     *
32
-     * @var int $_tag
33
-     */
34
-    protected $_tag;
29
+	/**
30
+	 * Element tag.
31
+	 *
32
+	 * @var int $_tag
33
+	 */
34
+	protected $_tag;
35 35
     
36
-    /**
37
-     * Constructor.
38
-     *
39
-     * @param string $text
40
-     * @param int $tag
41
-     */
42
-    public function __construct(string $text, int $tag)
43
-    {
44
-        $this->_text = $text;
45
-        $this->_tag = $tag;
46
-    }
36
+	/**
37
+	 * Constructor.
38
+	 *
39
+	 * @param string $text
40
+	 * @param int $tag
41
+	 */
42
+	public function __construct(string $text, int $tag)
43
+	{
44
+		$this->_text = $text;
45
+		$this->_tag = $tag;
46
+	}
47 47
     
48
-    /**
49
-     * Initialize from ASN.1.
50
-     *
51
-     * @param StringType $el
52
-     * @return self
53
-     */
54
-    public static function fromASN1(StringType $el): self
55
-    {
56
-        return new self($el->string(), $el->tag());
57
-    }
48
+	/**
49
+	 * Initialize from ASN.1.
50
+	 *
51
+	 * @param StringType $el
52
+	 * @return self
53
+	 */
54
+	public static function fromASN1(StringType $el): self
55
+	{
56
+		return new self($el->string(), $el->tag());
57
+	}
58 58
     
59
-    /**
60
-     * Initialize from a UTF-8 string.
61
-     *
62
-     * @param string $str
63
-     * @return self
64
-     */
65
-    public static function fromString(string $str): self
66
-    {
67
-        return new self($str, Element::TYPE_UTF8_STRING);
68
-    }
59
+	/**
60
+	 * Initialize from a UTF-8 string.
61
+	 *
62
+	 * @param string $str
63
+	 * @return self
64
+	 */
65
+	public static function fromString(string $str): self
66
+	{
67
+		return new self($str, Element::TYPE_UTF8_STRING);
68
+	}
69 69
     
70
-    /**
71
-     * Get the text.
72
-     *
73
-     * @return string
74
-     */
75
-    public function string(): string
76
-    {
77
-        return $this->_text;
78
-    }
70
+	/**
71
+	 * Get the text.
72
+	 *
73
+	 * @return string
74
+	 */
75
+	public function string(): string
76
+	{
77
+		return $this->_text;
78
+	}
79 79
     
80
-    /**
81
-     * Generate ASN.1 element.
82
-     *
83
-     * @throws \UnexpectedValueException
84
-     * @return StringType
85
-     */
86
-    public function toASN1(): StringType
87
-    {
88
-        switch ($this->_tag) {
89
-            case Element::TYPE_IA5_STRING:
90
-                return new IA5String($this->_text);
91
-            case Element::TYPE_VISIBLE_STRING:
92
-                return new VisibleString($this->_text);
93
-            case Element::TYPE_BMP_STRING:
94
-                return new BMPString($this->_text);
95
-            case Element::TYPE_UTF8_STRING:
96
-                return new UTF8String($this->_text);
97
-            default:
98
-                throw new \UnexpectedValueException(
99
-                    "Type " . Element::tagToName($this->_tag) . " not supported.");
100
-        }
101
-    }
80
+	/**
81
+	 * Generate ASN.1 element.
82
+	 *
83
+	 * @throws \UnexpectedValueException
84
+	 * @return StringType
85
+	 */
86
+	public function toASN1(): StringType
87
+	{
88
+		switch ($this->_tag) {
89
+			case Element::TYPE_IA5_STRING:
90
+				return new IA5String($this->_text);
91
+			case Element::TYPE_VISIBLE_STRING:
92
+				return new VisibleString($this->_text);
93
+			case Element::TYPE_BMP_STRING:
94
+				return new BMPString($this->_text);
95
+			case Element::TYPE_UTF8_STRING:
96
+				return new UTF8String($this->_text);
97
+			default:
98
+				throw new \UnexpectedValueException(
99
+					"Type " . Element::tagToName($this->_tag) . " not supported.");
100
+		}
101
+	}
102 102
     
103
-    /**
104
-     *
105
-     * @return string
106
-     */
107
-    public function __toString()
108
-    {
109
-        return $this->string();
110
-    }
103
+	/**
104
+	 *
105
+	 * @return string
106
+	 */
107
+	public function __toString()
108
+	{
109
+		return $this->string();
110
+	}
111 111
 }
Please login to merge, or discard this patch.
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -86,17 +86,17 @@
 block discarded – undo
86 86
     public function toASN1(): StringType
87 87
     {
88 88
         switch ($this->_tag) {
89
-            case Element::TYPE_IA5_STRING:
90
-                return new IA5String($this->_text);
91
-            case Element::TYPE_VISIBLE_STRING:
92
-                return new VisibleString($this->_text);
93
-            case Element::TYPE_BMP_STRING:
94
-                return new BMPString($this->_text);
95
-            case Element::TYPE_UTF8_STRING:
96
-                return new UTF8String($this->_text);
97
-            default:
98
-                throw new \UnexpectedValueException(
99
-                    "Type " . Element::tagToName($this->_tag) . " not supported.");
89
+        case Element::TYPE_IA5_STRING:
90
+            return new IA5String($this->_text);
91
+        case Element::TYPE_VISIBLE_STRING:
92
+            return new VisibleString($this->_text);
93
+        case Element::TYPE_BMP_STRING:
94
+            return new BMPString($this->_text);
95
+        case Element::TYPE_UTF8_STRING:
96
+            return new UTF8String($this->_text);
97
+        default:
98
+            throw new \UnexpectedValueException(
99
+                "Type " . Element::tagToName($this->_tag) . " not supported.");
100 100
         }
101 101
     }
102 102
     
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/PolicyQualifierInfo.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -16,85 +16,85 @@
 block discarded – undo
16 16
  */
17 17
 abstract class PolicyQualifierInfo
18 18
 {
19
-    /**
20
-     * OID for the CPS Pointer qualifier.
21
-     *
22
-     * @var string
23
-     */
24
-    const OID_CPS = "1.3.6.1.5.5.7.2.1";
19
+	/**
20
+	 * OID for the CPS Pointer qualifier.
21
+	 *
22
+	 * @var string
23
+	 */
24
+	const OID_CPS = "1.3.6.1.5.5.7.2.1";
25 25
     
26
-    /**
27
-     * OID for the user notice qualifier.
28
-     *
29
-     * @var string
30
-     */
31
-    const OID_UNOTICE = "1.3.6.1.5.5.7.2.2";
26
+	/**
27
+	 * OID for the user notice qualifier.
28
+	 *
29
+	 * @var string
30
+	 */
31
+	const OID_UNOTICE = "1.3.6.1.5.5.7.2.2";
32 32
     
33
-    /**
34
-     * Qualifier identifier.
35
-     *
36
-     * @var string $_oid
37
-     */
38
-    protected $_oid;
33
+	/**
34
+	 * Qualifier identifier.
35
+	 *
36
+	 * @var string $_oid
37
+	 */
38
+	protected $_oid;
39 39
     
40
-    /**
41
-     * Generate ASN.1 for the 'qualifier' field.
42
-     *
43
-     * @return \ASN1\Element
44
-     */
45
-    abstract protected function _qualifierASN1();
40
+	/**
41
+	 * Generate ASN.1 for the 'qualifier' field.
42
+	 *
43
+	 * @return \ASN1\Element
44
+	 */
45
+	abstract protected function _qualifierASN1();
46 46
     
47
-    /**
48
-     * Initialize from qualifier ASN.1 element.
49
-     *
50
-     * @param UnspecifiedType $el
51
-     * @return self
52
-     */
53
-    public static function fromQualifierASN1(UnspecifiedType $el)
54
-    {
55
-        throw new \BadMethodCallException(
56
-            __FUNCTION__ . " must be implemented in the derived class.");
57
-    }
47
+	/**
48
+	 * Initialize from qualifier ASN.1 element.
49
+	 *
50
+	 * @param UnspecifiedType $el
51
+	 * @return self
52
+	 */
53
+	public static function fromQualifierASN1(UnspecifiedType $el)
54
+	{
55
+		throw new \BadMethodCallException(
56
+			__FUNCTION__ . " must be implemented in the derived class.");
57
+	}
58 58
     
59
-    /**
60
-     * Initialize from ASN.1.
61
-     *
62
-     * @param Sequence $seq
63
-     * @throws \UnexpectedValueException
64
-     * @return self
65
-     */
66
-    public static function fromASN1(Sequence $seq): self
67
-    {
68
-        $oid = $seq->at(0)
69
-            ->asObjectIdentifier()
70
-            ->oid();
71
-        switch ($oid) {
72
-            case self::OID_CPS:
73
-                return CPSQualifier::fromQualifierASN1($seq->at(1));
74
-            case self::OID_UNOTICE:
75
-                return UserNoticeQualifier::fromQualifierASN1($seq->at(1));
76
-        }
77
-        throw new \UnexpectedValueException("Qualifier $oid not supported.");
78
-    }
59
+	/**
60
+	 * Initialize from ASN.1.
61
+	 *
62
+	 * @param Sequence $seq
63
+	 * @throws \UnexpectedValueException
64
+	 * @return self
65
+	 */
66
+	public static function fromASN1(Sequence $seq): self
67
+	{
68
+		$oid = $seq->at(0)
69
+			->asObjectIdentifier()
70
+			->oid();
71
+		switch ($oid) {
72
+			case self::OID_CPS:
73
+				return CPSQualifier::fromQualifierASN1($seq->at(1));
74
+			case self::OID_UNOTICE:
75
+				return UserNoticeQualifier::fromQualifierASN1($seq->at(1));
76
+		}
77
+		throw new \UnexpectedValueException("Qualifier $oid not supported.");
78
+	}
79 79
     
80
-    /**
81
-     * Get qualifier identifier.
82
-     *
83
-     * @return string
84
-     */
85
-    public function oid(): string
86
-    {
87
-        return $this->_oid;
88
-    }
80
+	/**
81
+	 * Get qualifier identifier.
82
+	 *
83
+	 * @return string
84
+	 */
85
+	public function oid(): string
86
+	{
87
+		return $this->_oid;
88
+	}
89 89
     
90
-    /**
91
-     * Generate ASN.1 structure.
92
-     *
93
-     * @return Sequence
94
-     */
95
-    public function toASN1(): Sequence
96
-    {
97
-        return new Sequence(new ObjectIdentifier($this->_oid),
98
-            $this->_qualifierASN1());
99
-    }
90
+	/**
91
+	 * Generate ASN.1 structure.
92
+	 *
93
+	 * @return Sequence
94
+	 */
95
+	public function toASN1(): Sequence
96
+	{
97
+		return new Sequence(new ObjectIdentifier($this->_oid),
98
+			$this->_qualifierASN1());
99
+	}
100 100
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/CPSQualifier.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -15,51 +15,51 @@
 block discarded – undo
15 15
  */
16 16
 class CPSQualifier extends PolicyQualifierInfo
17 17
 {
18
-    /**
19
-     * URI.
20
-     *
21
-     * @var string $_uri
22
-     */
23
-    protected $_uri;
18
+	/**
19
+	 * URI.
20
+	 *
21
+	 * @var string $_uri
22
+	 */
23
+	protected $_uri;
24 24
     
25
-    /**
26
-     * Constructor.
27
-     *
28
-     * @param string $uri
29
-     */
30
-    public function __construct(string $uri)
31
-    {
32
-        $this->_oid = self::OID_CPS;
33
-        $this->_uri = $uri;
34
-    }
25
+	/**
26
+	 * Constructor.
27
+	 *
28
+	 * @param string $uri
29
+	 */
30
+	public function __construct(string $uri)
31
+	{
32
+		$this->_oid = self::OID_CPS;
33
+		$this->_uri = $uri;
34
+	}
35 35
     
36
-    /**
37
-     *
38
-     * @param UnspecifiedType $el
39
-     * @return self
40
-     */
41
-    public static function fromQualifierASN1(UnspecifiedType $el): self
42
-    {
43
-        return new self($el->asString()->string());
44
-    }
36
+	/**
37
+	 *
38
+	 * @param UnspecifiedType $el
39
+	 * @return self
40
+	 */
41
+	public static function fromQualifierASN1(UnspecifiedType $el): self
42
+	{
43
+		return new self($el->asString()->string());
44
+	}
45 45
     
46
-    /**
47
-     * Get URI.
48
-     *
49
-     * @return string
50
-     */
51
-    public function uri(): string
52
-    {
53
-        return $this->_uri;
54
-    }
46
+	/**
47
+	 * Get URI.
48
+	 *
49
+	 * @return string
50
+	 */
51
+	public function uri(): string
52
+	{
53
+		return $this->_uri;
54
+	}
55 55
     
56
-    /**
57
-     *
58
-     * {@inheritdoc}
59
-     * @return IA5String
60
-     */
61
-    protected function _qualifierASN1(): IA5String
62
-    {
63
-        return new IA5String($this->_uri);
64
-    }
56
+	/**
57
+	 *
58
+	 * {@inheritdoc}
59
+	 * @return IA5String
60
+	 */
61
+	protected function _qualifierASN1(): IA5String
62
+	{
63
+		return new IA5String($this->_uri);
64
+	}
65 65
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/UserNoticeQualifier.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -16,114 +16,114 @@
 block discarded – undo
16 16
  */
17 17
 class UserNoticeQualifier extends PolicyQualifierInfo
18 18
 {
19
-    /**
20
-     * Explicit notice text.
21
-     *
22
-     * @var DisplayText $_text
23
-     */
24
-    protected $_text;
19
+	/**
20
+	 * Explicit notice text.
21
+	 *
22
+	 * @var DisplayText $_text
23
+	 */
24
+	protected $_text;
25 25
     
26
-    /**
27
-     * Notice reference.
28
-     *
29
-     * @var NoticeReference $_ref
30
-     */
31
-    protected $_ref;
26
+	/**
27
+	 * Notice reference.
28
+	 *
29
+	 * @var NoticeReference $_ref
30
+	 */
31
+	protected $_ref;
32 32
     
33
-    /**
34
-     * Constructor.
35
-     *
36
-     * @param DisplayText|null $text
37
-     * @param NoticeReference|null $ref
38
-     */
39
-    public function __construct(DisplayText $text = null, NoticeReference $ref = null)
40
-    {
41
-        $this->_oid = self::OID_UNOTICE;
42
-        $this->_text = $text;
43
-        $this->_ref = $ref;
44
-    }
33
+	/**
34
+	 * Constructor.
35
+	 *
36
+	 * @param DisplayText|null $text
37
+	 * @param NoticeReference|null $ref
38
+	 */
39
+	public function __construct(DisplayText $text = null, NoticeReference $ref = null)
40
+	{
41
+		$this->_oid = self::OID_UNOTICE;
42
+		$this->_text = $text;
43
+		$this->_ref = $ref;
44
+	}
45 45
     
46
-    /**
47
-     *
48
-     * @param UnspecifiedType $el
49
-     * @return self
50
-     */
51
-    public static function fromQualifierASN1(UnspecifiedType $el): self
52
-    {
53
-        $seq = $el->asSequence();
54
-        $ref = null;
55
-        $text = null;
56
-        $idx = 0;
57
-        if ($seq->has($idx, Element::TYPE_SEQUENCE)) {
58
-            $ref = NoticeReference::fromASN1($seq->at($idx++)->asSequence());
59
-        }
60
-        if ($seq->has($idx, Element::TYPE_STRING)) {
61
-            $text = DisplayText::fromASN1($seq->at($idx)->asString());
62
-        }
63
-        return new self($text, $ref);
64
-    }
46
+	/**
47
+	 *
48
+	 * @param UnspecifiedType $el
49
+	 * @return self
50
+	 */
51
+	public static function fromQualifierASN1(UnspecifiedType $el): self
52
+	{
53
+		$seq = $el->asSequence();
54
+		$ref = null;
55
+		$text = null;
56
+		$idx = 0;
57
+		if ($seq->has($idx, Element::TYPE_SEQUENCE)) {
58
+			$ref = NoticeReference::fromASN1($seq->at($idx++)->asSequence());
59
+		}
60
+		if ($seq->has($idx, Element::TYPE_STRING)) {
61
+			$text = DisplayText::fromASN1($seq->at($idx)->asString());
62
+		}
63
+		return new self($text, $ref);
64
+	}
65 65
     
66
-    /**
67
-     * Whether explicit text is present.
68
-     *
69
-     * @return bool
70
-     */
71
-    public function hasExplicitText(): bool
72
-    {
73
-        return isset($this->_text);
74
-    }
66
+	/**
67
+	 * Whether explicit text is present.
68
+	 *
69
+	 * @return bool
70
+	 */
71
+	public function hasExplicitText(): bool
72
+	{
73
+		return isset($this->_text);
74
+	}
75 75
     
76
-    /**
77
-     * Get explicit text.
78
-     *
79
-     * @return DisplayText
80
-     */
81
-    public function explicitText(): DisplayText
82
-    {
83
-        if (!$this->hasExplicitText()) {
84
-            throw new \LogicException("explicitText not set.");
85
-        }
86
-        return $this->_text;
87
-    }
76
+	/**
77
+	 * Get explicit text.
78
+	 *
79
+	 * @return DisplayText
80
+	 */
81
+	public function explicitText(): DisplayText
82
+	{
83
+		if (!$this->hasExplicitText()) {
84
+			throw new \LogicException("explicitText not set.");
85
+		}
86
+		return $this->_text;
87
+	}
88 88
     
89
-    /**
90
-     * Whether notice reference is present.
91
-     *
92
-     * @return bool
93
-     */
94
-    public function hasNoticeRef(): bool
95
-    {
96
-        return isset($this->_ref);
97
-    }
89
+	/**
90
+	 * Whether notice reference is present.
91
+	 *
92
+	 * @return bool
93
+	 */
94
+	public function hasNoticeRef(): bool
95
+	{
96
+		return isset($this->_ref);
97
+	}
98 98
     
99
-    /**
100
-     * Get notice reference.
101
-     *
102
-     * @throws \RuntimeException
103
-     * @return NoticeReference
104
-     */
105
-    public function noticeRef(): NoticeReference
106
-    {
107
-        if (!$this->hasNoticeRef()) {
108
-            throw new \LogicException("noticeRef not set.");
109
-        }
110
-        return $this->_ref;
111
-    }
99
+	/**
100
+	 * Get notice reference.
101
+	 *
102
+	 * @throws \RuntimeException
103
+	 * @return NoticeReference
104
+	 */
105
+	public function noticeRef(): NoticeReference
106
+	{
107
+		if (!$this->hasNoticeRef()) {
108
+			throw new \LogicException("noticeRef not set.");
109
+		}
110
+		return $this->_ref;
111
+	}
112 112
     
113
-    /**
114
-     *
115
-     * {@inheritdoc}
116
-     * @return Sequence
117
-     */
118
-    protected function _qualifierASN1(): Sequence
119
-    {
120
-        $elements = array();
121
-        if (isset($this->_ref)) {
122
-            $elements[] = $this->_ref->toASN1();
123
-        }
124
-        if (isset($this->_text)) {
125
-            $elements[] = $this->_text->toASN1();
126
-        }
127
-        return new Sequence(...$elements);
128
-    }
113
+	/**
114
+	 *
115
+	 * {@inheritdoc}
116
+	 * @return Sequence
117
+	 */
118
+	protected function _qualifierASN1(): Sequence
119
+	{
120
+		$elements = array();
121
+		if (isset($this->_ref)) {
122
+			$elements[] = $this->_ref->toASN1();
123
+		}
124
+		if (isset($this->_text)) {
125
+			$elements[] = $this->_text->toASN1();
126
+		}
127
+		return new Sequence(...$elements);
128
+	}
129 129
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/NoticeReference.php 2 patches
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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $org = DisplayText::fromASN1($seq->at(0)->asString());
54 54
         $numbers = array_map(
55
-            function (UnspecifiedType $el) {
55
+            function(UnspecifiedType $el) {
56 56
                 return $el->asInteger()->intNumber();
57 57
             },
58 58
             $seq->at(1)
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $org = $this->_organization->toASN1();
92 92
         $nums = array_map(
93
-            function ($number) {
93
+            function($number) {
94 94
                 return new Integer($number);
95 95
             }, $this->_numbers);
96 96
         return new Sequence($org, new Sequence(...$nums));
Please login to merge, or discard this patch.