Passed
Push — php72 ( a3eac9...46ea07 )
by Joni
02:06
created
lib/X501/StringPrep/StringPreparer.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -11,77 +11,77 @@
 block discarded – undo
11 11
  */
12 12
 class StringPreparer
13 13
 {
14
-    const STEP_TRANSCODE = 1;
15
-    const STEP_MAP = 2;
16
-    const STEP_NORMALIZE = 3;
17
-    const STEP_PROHIBIT = 4;
18
-    const STEP_CHECK_BIDI = 5;
19
-    const STEP_INSIGNIFICANT_CHARS = 6;
14
+	const STEP_TRANSCODE = 1;
15
+	const STEP_MAP = 2;
16
+	const STEP_NORMALIZE = 3;
17
+	const STEP_PROHIBIT = 4;
18
+	const STEP_CHECK_BIDI = 5;
19
+	const STEP_INSIGNIFICANT_CHARS = 6;
20 20
 
21
-    /**
22
-     * Preparation steps.
23
-     *
24
-     * @var PrepareStep[]
25
-     */
26
-    protected $_steps;
21
+	/**
22
+	 * Preparation steps.
23
+	 *
24
+	 * @var PrepareStep[]
25
+	 */
26
+	protected $_steps;
27 27
 
28
-    /**
29
-     * Constructor.
30
-     *
31
-     * @param PrepareStep[] $steps Preparation steps to apply
32
-     */
33
-    protected function __construct(array $steps)
34
-    {
35
-        $this->_steps = $steps;
36
-    }
28
+	/**
29
+	 * Constructor.
30
+	 *
31
+	 * @param PrepareStep[] $steps Preparation steps to apply
32
+	 */
33
+	protected function __construct(array $steps)
34
+	{
35
+		$this->_steps = $steps;
36
+	}
37 37
 
38
-    /**
39
-     * Get default instance for given string type.
40
-     *
41
-     * @param int $string_type ASN.1 string type tag.
42
-     *
43
-     * @return self
44
-     */
45
-    public static function forStringType(int $string_type): self
46
-    {
47
-        $steps = [
48
-            self::STEP_TRANSCODE => new TranscodeStep($string_type),
49
-            self::STEP_MAP => new MapStep(),
50
-            self::STEP_NORMALIZE => new NormalizeStep(),
51
-            self::STEP_PROHIBIT => new ProhibitStep(),
52
-            self::STEP_CHECK_BIDI => new CheckBidiStep(),
53
-            // @todo Vary by string type
54
-            self::STEP_INSIGNIFICANT_CHARS => new InsignificantNonSubstringSpaceStep(),
55
-        ];
56
-        return new self($steps);
57
-    }
38
+	/**
39
+	 * Get default instance for given string type.
40
+	 *
41
+	 * @param int $string_type ASN.1 string type tag.
42
+	 *
43
+	 * @return self
44
+	 */
45
+	public static function forStringType(int $string_type): self
46
+	{
47
+		$steps = [
48
+			self::STEP_TRANSCODE => new TranscodeStep($string_type),
49
+			self::STEP_MAP => new MapStep(),
50
+			self::STEP_NORMALIZE => new NormalizeStep(),
51
+			self::STEP_PROHIBIT => new ProhibitStep(),
52
+			self::STEP_CHECK_BIDI => new CheckBidiStep(),
53
+			// @todo Vary by string type
54
+			self::STEP_INSIGNIFICANT_CHARS => new InsignificantNonSubstringSpaceStep(),
55
+		];
56
+		return new self($steps);
57
+	}
58 58
 
59
-    /**
60
-     * Get self with case folding set.
61
-     *
62
-     * @param bool $fold True to apply case folding
63
-     *
64
-     * @return self
65
-     */
66
-    public function withCaseFolding(bool $fold): self
67
-    {
68
-        $obj = clone $this;
69
-        $obj->_steps[self::STEP_MAP] = new MapStep($fold);
70
-        return $obj;
71
-    }
59
+	/**
60
+	 * Get self with case folding set.
61
+	 *
62
+	 * @param bool $fold True to apply case folding
63
+	 *
64
+	 * @return self
65
+	 */
66
+	public function withCaseFolding(bool $fold): self
67
+	{
68
+		$obj = clone $this;
69
+		$obj->_steps[self::STEP_MAP] = new MapStep($fold);
70
+		return $obj;
71
+	}
72 72
 
73
-    /**
74
-     * Prepare string.
75
-     *
76
-     * @param string $string
77
-     *
78
-     * @return string
79
-     */
80
-    public function prepare(string $string): string
81
-    {
82
-        foreach ($this->_steps as $step) {
83
-            $string = $step->apply($string);
84
-        }
85
-        return $string;
86
-    }
73
+	/**
74
+	 * Prepare string.
75
+	 *
76
+	 * @param string $string
77
+	 *
78
+	 * @return string
79
+	 */
80
+	public function prepare(string $string): string
81
+	{
82
+		foreach ($this->_steps as $step) {
83
+			$string = $step->apply($string);
84
+		}
85
+		return $string;
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\StringPrep;
6 6
 
Please login to merge, or discard this patch.
lib/X501/StringPrep/CheckBidiStep.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
  */
13 13
 class CheckBidiStep implements PrepareStep
14 14
 {
15
-    /**
16
-     * @param string $string UTF-8 encoded string
17
-     *
18
-     * @return string
19
-     */
20
-    public function apply(string $string): string
21
-    {
22
-        // @todo Implement
23
-        return $string;
24
-    }
15
+	/**
16
+	 * @param string $string UTF-8 encoded string
17
+	 *
18
+	 * @return string
19
+	 */
20
+	public function apply(string $string): string
21
+	{
22
+		// @todo Implement
23
+		return $string;
24
+	}
25 25
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\StringPrep;
6 6
 
Please login to merge, or discard this patch.
lib/X501/StringPrep/InsignificantNonSubstringSpaceStep.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,22 +14,22 @@
 block discarded – undo
14 14
  */
15 15
 class InsignificantNonSubstringSpaceStep implements PrepareStep
16 16
 {
17
-    /**
18
-     * @param string $string UTF-8 encoded string
19
-     *
20
-     * @return string
21
-     */
22
-    public function apply(string $string): string
23
-    {
24
-        // if value contains no non-space characters
25
-        if (preg_match('/^\p{Zs}*$/u', $string)) {
26
-            return '  ';
27
-        }
28
-        // trim leading and trailing spaces
29
-        $string = preg_replace('/^\p{Zs}+/u', '', $string);
30
-        $string = preg_replace('/\p{Zs}+$/u', '', $string);
31
-        // convert inner space sequences to two U+0020 characters
32
-        $string = preg_replace('/\p{Zs}+/u', '  ', $string);
33
-        return " {$string} ";
34
-    }
17
+	/**
18
+	 * @param string $string UTF-8 encoded string
19
+	 *
20
+	 * @return string
21
+	 */
22
+	public function apply(string $string): string
23
+	{
24
+		// if value contains no non-space characters
25
+		if (preg_match('/^\p{Zs}*$/u', $string)) {
26
+			return '  ';
27
+		}
28
+		// trim leading and trailing spaces
29
+		$string = preg_replace('/^\p{Zs}+/u', '', $string);
30
+		$string = preg_replace('/\p{Zs}+$/u', '', $string);
31
+		// convert inner space sequences to two U+0020 characters
32
+		$string = preg_replace('/\p{Zs}+/u', '  ', $string);
33
+		return " {$string} ";
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\StringPrep;
6 6
 
Please login to merge, or discard this patch.
lib/X501/ASN1/Attribute.php 2 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -17,163 +17,163 @@
 block discarded – undo
17 17
  */
18 18
 class Attribute implements \Countable, \IteratorAggregate
19 19
 {
20
-    use TypedAttribute;
20
+	use TypedAttribute;
21 21
 
22
-    /**
23
-     * Attribute values.
24
-     *
25
-     * @var AttributeValue[]
26
-     */
27
-    protected $_values;
22
+	/**
23
+	 * Attribute values.
24
+	 *
25
+	 * @var AttributeValue[]
26
+	 */
27
+	protected $_values;
28 28
 
29
-    /**
30
-     * Constructor.
31
-     *
32
-     * @param AttributeType  $type      Attribute type
33
-     * @param AttributeValue ...$values Attribute values
34
-     */
35
-    public function __construct(AttributeType $type, AttributeValue ...$values)
36
-    {
37
-        // check that attribute values have correct oid
38
-        array_walk($values,
39
-            function (AttributeValue $value) use ($type) {
40
-                if ($value->oid() != $type->oid()) {
41
-                    throw new \LogicException('Attribute OID mismatch.');
42
-                }
43
-            });
44
-        $this->_type = $type;
45
-        $this->_values = $values;
46
-    }
29
+	/**
30
+	 * Constructor.
31
+	 *
32
+	 * @param AttributeType  $type      Attribute type
33
+	 * @param AttributeValue ...$values Attribute values
34
+	 */
35
+	public function __construct(AttributeType $type, AttributeValue ...$values)
36
+	{
37
+		// check that attribute values have correct oid
38
+		array_walk($values,
39
+			function (AttributeValue $value) use ($type) {
40
+				if ($value->oid() != $type->oid()) {
41
+					throw new \LogicException('Attribute OID mismatch.');
42
+				}
43
+			});
44
+		$this->_type = $type;
45
+		$this->_values = $values;
46
+	}
47 47
 
48
-    /**
49
-     * Initialize from ASN.1.
50
-     *
51
-     * @param Sequence $seq
52
-     *
53
-     * @return self
54
-     */
55
-    public static function fromASN1(Sequence $seq): self
56
-    {
57
-        $type = AttributeType::fromASN1($seq->at(0)->asObjectIdentifier());
58
-        $values = array_map(
59
-            function (UnspecifiedType $el) use ($type) {
60
-                return AttributeValue::fromASN1ByOID($type->oid(), $el);
61
-            }, $seq->at(1)
62
-                ->asSet()
63
-                ->elements());
64
-        return new self($type, ...$values);
65
-    }
48
+	/**
49
+	 * Initialize from ASN.1.
50
+	 *
51
+	 * @param Sequence $seq
52
+	 *
53
+	 * @return self
54
+	 */
55
+	public static function fromASN1(Sequence $seq): self
56
+	{
57
+		$type = AttributeType::fromASN1($seq->at(0)->asObjectIdentifier());
58
+		$values = array_map(
59
+			function (UnspecifiedType $el) use ($type) {
60
+				return AttributeValue::fromASN1ByOID($type->oid(), $el);
61
+			}, $seq->at(1)
62
+				->asSet()
63
+				->elements());
64
+		return new self($type, ...$values);
65
+	}
66 66
 
67
-    /**
68
-     * Convenience method to initialize from attribute values.
69
-     *
70
-     * @param AttributeValue ...$values One or more values
71
-     *
72
-     * @throws \LogicException
73
-     *
74
-     * @return self
75
-     */
76
-    public static function fromAttributeValues(AttributeValue ...$values): self
77
-    {
78
-        // we need at least one value to determine OID
79
-        if (!count($values)) {
80
-            throw new \LogicException('No values.');
81
-        }
82
-        $oid = reset($values)->oid();
83
-        return new self(new AttributeType($oid), ...$values);
84
-    }
67
+	/**
68
+	 * Convenience method to initialize from attribute values.
69
+	 *
70
+	 * @param AttributeValue ...$values One or more values
71
+	 *
72
+	 * @throws \LogicException
73
+	 *
74
+	 * @return self
75
+	 */
76
+	public static function fromAttributeValues(AttributeValue ...$values): self
77
+	{
78
+		// we need at least one value to determine OID
79
+		if (!count($values)) {
80
+			throw new \LogicException('No values.');
81
+		}
82
+		$oid = reset($values)->oid();
83
+		return new self(new AttributeType($oid), ...$values);
84
+	}
85 85
 
86
-    /**
87
-     * Get first value of the attribute.
88
-     *
89
-     * @throws \LogicException
90
-     *
91
-     * @return AttributeValue
92
-     */
93
-    public function first(): AttributeValue
94
-    {
95
-        if (!count($this->_values)) {
96
-            throw new \LogicException('Attribute contains no values.');
97
-        }
98
-        return $this->_values[0];
99
-    }
86
+	/**
87
+	 * Get first value of the attribute.
88
+	 *
89
+	 * @throws \LogicException
90
+	 *
91
+	 * @return AttributeValue
92
+	 */
93
+	public function first(): AttributeValue
94
+	{
95
+		if (!count($this->_values)) {
96
+			throw new \LogicException('Attribute contains no values.');
97
+		}
98
+		return $this->_values[0];
99
+	}
100 100
 
101
-    /**
102
-     * Get all values.
103
-     *
104
-     * @return AttributeValue[]
105
-     */
106
-    public function values(): array
107
-    {
108
-        return $this->_values;
109
-    }
101
+	/**
102
+	 * Get all values.
103
+	 *
104
+	 * @return AttributeValue[]
105
+	 */
106
+	public function values(): array
107
+	{
108
+		return $this->_values;
109
+	}
110 110
 
111
-    /**
112
-     * Generate ASN.1 structure.
113
-     *
114
-     * @return Sequence
115
-     */
116
-    public function toASN1(): Sequence
117
-    {
118
-        $values = array_map(
119
-            function (AttributeValue $value) {
120
-                return $value->toASN1();
121
-            }, $this->_values);
122
-        $valueset = new Set(...$values);
123
-        return new Sequence($this->_type->toASN1(), $valueset->sortedSetOf());
124
-    }
111
+	/**
112
+	 * Generate ASN.1 structure.
113
+	 *
114
+	 * @return Sequence
115
+	 */
116
+	public function toASN1(): Sequence
117
+	{
118
+		$values = array_map(
119
+			function (AttributeValue $value) {
120
+				return $value->toASN1();
121
+			}, $this->_values);
122
+		$valueset = new Set(...$values);
123
+		return new Sequence($this->_type->toASN1(), $valueset->sortedSetOf());
124
+	}
125 125
 
126
-    /**
127
-     * Cast attribute values to another AttributeValue class.
128
-     *
129
-     * This method is generally used to cast UnknownAttributeValue values
130
-     * to specific objects when class is declared outside this package.
131
-     *
132
-     * The new class must be derived from AttributeValue and have the same OID
133
-     * as current attribute values.
134
-     *
135
-     * @param string $cls AttributeValue class name
136
-     *
137
-     * @throws \LogicException
138
-     *
139
-     * @return self
140
-     */
141
-    public function castValues(string $cls): self
142
-    {
143
-        $refl = new \ReflectionClass($cls);
144
-        if (!$refl->isSubclassOf(AttributeValue::class)) {
145
-            throw new \LogicException(
146
-                "{$cls} must be derived from " . AttributeValue::class . '.');
147
-        }
148
-        $oid = $this->oid();
149
-        $values = array_map(
150
-            function (AttributeValue $value) use ($cls, $oid) {
151
-                $value = $cls::fromSelf($value);
152
-                if ($value->oid() != $oid) {
153
-                    throw new \LogicException('Attribute OID mismatch.');
154
-                }
155
-                return $value;
156
-            }, $this->_values);
157
-        return self::fromAttributeValues(...$values);
158
-    }
126
+	/**
127
+	 * Cast attribute values to another AttributeValue class.
128
+	 *
129
+	 * This method is generally used to cast UnknownAttributeValue values
130
+	 * to specific objects when class is declared outside this package.
131
+	 *
132
+	 * The new class must be derived from AttributeValue and have the same OID
133
+	 * as current attribute values.
134
+	 *
135
+	 * @param string $cls AttributeValue class name
136
+	 *
137
+	 * @throws \LogicException
138
+	 *
139
+	 * @return self
140
+	 */
141
+	public function castValues(string $cls): self
142
+	{
143
+		$refl = new \ReflectionClass($cls);
144
+		if (!$refl->isSubclassOf(AttributeValue::class)) {
145
+			throw new \LogicException(
146
+				"{$cls} must be derived from " . AttributeValue::class . '.');
147
+		}
148
+		$oid = $this->oid();
149
+		$values = array_map(
150
+			function (AttributeValue $value) use ($cls, $oid) {
151
+				$value = $cls::fromSelf($value);
152
+				if ($value->oid() != $oid) {
153
+					throw new \LogicException('Attribute OID mismatch.');
154
+				}
155
+				return $value;
156
+			}, $this->_values);
157
+		return self::fromAttributeValues(...$values);
158
+	}
159 159
 
160
-    /**
161
-     * @see \Countable::count()
162
-     *
163
-     * @return int
164
-     */
165
-    public function count(): int
166
-    {
167
-        return count($this->_values);
168
-    }
160
+	/**
161
+	 * @see \Countable::count()
162
+	 *
163
+	 * @return int
164
+	 */
165
+	public function count(): int
166
+	{
167
+		return count($this->_values);
168
+	}
169 169
 
170
-    /**
171
-     * @see \IteratorAggregate::getIterator()
172
-     *
173
-     * @return \ArrayIterator
174
-     */
175
-    public function getIterator(): \ArrayIterator
176
-    {
177
-        return new \ArrayIterator($this->_values);
178
-    }
170
+	/**
171
+	 * @see \IteratorAggregate::getIterator()
172
+	 *
173
+	 * @return \ArrayIterator
174
+	 */
175
+	public function getIterator(): \ArrayIterator
176
+	{
177
+		return new \ArrayIterator($this->_values);
178
+	}
179 179
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\ASN1;
6 6
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         // check that attribute values have correct oid
38 38
         array_walk($values,
39
-            function (AttributeValue $value) use ($type) {
39
+            function(AttributeValue $value) use ($type) {
40 40
                 if ($value->oid() != $type->oid()) {
41 41
                     throw new \LogicException('Attribute OID mismatch.');
42 42
                 }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $type = AttributeType::fromASN1($seq->at(0)->asObjectIdentifier());
58 58
         $values = array_map(
59
-            function (UnspecifiedType $el) use ($type) {
59
+            function(UnspecifiedType $el) use ($type) {
60 60
                 return AttributeValue::fromASN1ByOID($type->oid(), $el);
61 61
             }, $seq->at(1)
62 62
                 ->asSet()
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     public function toASN1(): Sequence
117 117
     {
118 118
         $values = array_map(
119
-            function (AttributeValue $value) {
119
+            function(AttributeValue $value) {
120 120
                 return $value->toASN1();
121 121
             }, $this->_values);
122 122
         $valueset = new Set(...$values);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
         $oid = $this->oid();
149 149
         $values = array_map(
150
-            function (AttributeValue $value) use ($cls, $oid) {
150
+            function(AttributeValue $value) use ($cls, $oid) {
151 151
                 $value = $cls::fromSelf($value);
152 152
                 if ($value->oid() != $oid) {
153 153
                     throw new \LogicException('Attribute OID mismatch.');
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeTypeAndValue.php 2 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -15,114 +15,114 @@
 block discarded – undo
15 15
  */
16 16
 class AttributeTypeAndValue
17 17
 {
18
-    use TypedAttribute;
18
+	use TypedAttribute;
19 19
 
20
-    /**
21
-     * Attribute value.
22
-     *
23
-     * @var AttributeValue
24
-     */
25
-    protected $_value;
20
+	/**
21
+	 * Attribute value.
22
+	 *
23
+	 * @var AttributeValue
24
+	 */
25
+	protected $_value;
26 26
 
27
-    /**
28
-     * Constructor.
29
-     *
30
-     * @param AttributeType  $type  Attribute type
31
-     * @param AttributeValue $value Attribute value
32
-     */
33
-    public function __construct(AttributeType $type, AttributeValue $value)
34
-    {
35
-        $this->_type = $type;
36
-        $this->_value = $value;
37
-    }
27
+	/**
28
+	 * Constructor.
29
+	 *
30
+	 * @param AttributeType  $type  Attribute type
31
+	 * @param AttributeValue $value Attribute value
32
+	 */
33
+	public function __construct(AttributeType $type, AttributeValue $value)
34
+	{
35
+		$this->_type = $type;
36
+		$this->_value = $value;
37
+	}
38 38
 
39
-    /**
40
-     * @return string
41
-     */
42
-    public function __toString()
43
-    {
44
-        return $this->toString();
45
-    }
39
+	/**
40
+	 * @return string
41
+	 */
42
+	public function __toString()
43
+	{
44
+		return $this->toString();
45
+	}
46 46
 
47
-    /**
48
-     * Initialize from ASN.1.
49
-     *
50
-     * @param Sequence $seq
51
-     *
52
-     * @return self
53
-     */
54
-    public static function fromASN1(Sequence $seq): self
55
-    {
56
-        $type = AttributeType::fromASN1($seq->at(0)->asObjectIdentifier());
57
-        $value = AttributeValue::fromASN1ByOID($type->oid(), $seq->at(1));
58
-        return new self($type, $value);
59
-    }
47
+	/**
48
+	 * Initialize from ASN.1.
49
+	 *
50
+	 * @param Sequence $seq
51
+	 *
52
+	 * @return self
53
+	 */
54
+	public static function fromASN1(Sequence $seq): self
55
+	{
56
+		$type = AttributeType::fromASN1($seq->at(0)->asObjectIdentifier());
57
+		$value = AttributeValue::fromASN1ByOID($type->oid(), $seq->at(1));
58
+		return new self($type, $value);
59
+	}
60 60
 
61
-    /**
62
-     * Convenience method to initialize from attribute value.
63
-     *
64
-     * @param AttributeValue $value Attribute value
65
-     *
66
-     * @return self
67
-     */
68
-    public static function fromAttributeValue(AttributeValue $value): self
69
-    {
70
-        return new self(new AttributeType($value->oid()), $value);
71
-    }
61
+	/**
62
+	 * Convenience method to initialize from attribute value.
63
+	 *
64
+	 * @param AttributeValue $value Attribute value
65
+	 *
66
+	 * @return self
67
+	 */
68
+	public static function fromAttributeValue(AttributeValue $value): self
69
+	{
70
+		return new self(new AttributeType($value->oid()), $value);
71
+	}
72 72
 
73
-    /**
74
-     * Get attribute value.
75
-     *
76
-     * @return AttributeValue
77
-     */
78
-    public function value(): AttributeValue
79
-    {
80
-        return $this->_value;
81
-    }
73
+	/**
74
+	 * Get attribute value.
75
+	 *
76
+	 * @return AttributeValue
77
+	 */
78
+	public function value(): AttributeValue
79
+	{
80
+		return $this->_value;
81
+	}
82 82
 
83
-    /**
84
-     * Generate ASN.1 structure.
85
-     *
86
-     * @return Sequence
87
-     */
88
-    public function toASN1(): Sequence
89
-    {
90
-        return new Sequence($this->_type->toASN1(), $this->_value->toASN1());
91
-    }
83
+	/**
84
+	 * Generate ASN.1 structure.
85
+	 *
86
+	 * @return Sequence
87
+	 */
88
+	public function toASN1(): Sequence
89
+	{
90
+		return new Sequence($this->_type->toASN1(), $this->_value->toASN1());
91
+	}
92 92
 
93
-    /**
94
-     * Get attributeTypeAndValue string conforming to RFC 2253.
95
-     *
96
-     * @see https://tools.ietf.org/html/rfc2253#section-2.3
97
-     *
98
-     * @return string
99
-     */
100
-    public function toString(): string
101
-    {
102
-        return $this->_type->typeName() . '=' . $this->_value->rfc2253String();
103
-    }
93
+	/**
94
+	 * Get attributeTypeAndValue string conforming to RFC 2253.
95
+	 *
96
+	 * @see https://tools.ietf.org/html/rfc2253#section-2.3
97
+	 *
98
+	 * @return string
99
+	 */
100
+	public function toString(): string
101
+	{
102
+		return $this->_type->typeName() . '=' . $this->_value->rfc2253String();
103
+	}
104 104
 
105
-    /**
106
-     * Check whether attribute is semantically equal to other.
107
-     *
108
-     * @param AttributeTypeAndValue $other Object to compare to
109
-     *
110
-     * @return bool
111
-     */
112
-    public function equals(AttributeTypeAndValue $other): bool
113
-    {
114
-        // check that attribute types match
115
-        if ($this->oid() !== $other->oid()) {
116
-            return false;
117
-        }
118
-        $matcher = $this->_value->equalityMatchingRule();
119
-        $result = $matcher->compare($this->_value->stringValue(),
120
-            $other->_value->stringValue());
121
-        // match
122
-        if ($result) {
123
-            return true;
124
-        }
125
-        // no match or Undefined
126
-        return false;
127
-    }
105
+	/**
106
+	 * Check whether attribute is semantically equal to other.
107
+	 *
108
+	 * @param AttributeTypeAndValue $other Object to compare to
109
+	 *
110
+	 * @return bool
111
+	 */
112
+	public function equals(AttributeTypeAndValue $other): bool
113
+	{
114
+		// check that attribute types match
115
+		if ($this->oid() !== $other->oid()) {
116
+			return false;
117
+		}
118
+		$matcher = $this->_value->equalityMatchingRule();
119
+		$result = $matcher->compare($this->_value->stringValue(),
120
+			$other->_value->stringValue());
121
+		// match
122
+		if ($result) {
123
+			return true;
124
+		}
125
+		// no match or Undefined
126
+		return false;
127
+	}
128 128
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\ASN1;
6 6
 
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/LocalityNameValue.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
  */
15 15
 class LocalityNameValue extends DirectoryString
16 16
 {
17
-    /**
18
-     * Constructor.
19
-     *
20
-     * @param string $value      String value
21
-     * @param int    $string_tag Syntax choice
22
-     */
23
-    public function __construct(string $value,
24
-        int $string_tag = DirectoryString::UTF8)
25
-    {
26
-        $this->_oid = AttributeType::OID_LOCALITY_NAME;
27
-        parent::__construct($value, $string_tag);
28
-    }
17
+	/**
18
+	 * Constructor.
19
+	 *
20
+	 * @param string $value      String value
21
+	 * @param int    $string_tag Syntax choice
22
+	 */
23
+	public function __construct(string $value,
24
+		int $string_tag = DirectoryString::UTF8)
25
+	{
26
+		$this->_oid = AttributeType::OID_LOCALITY_NAME;
27
+		parent::__construct($value, $string_tag);
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\ASN1\AttributeValue;
6 6
 
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/NameValue.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
  */
15 15
 class NameValue extends DirectoryString
16 16
 {
17
-    /**
18
-     * Constructor.
19
-     *
20
-     * @param string $value      String value
21
-     * @param int    $string_tag Syntax choice
22
-     */
23
-    public function __construct(string $value,
24
-        int $string_tag = DirectoryString::UTF8)
25
-    {
26
-        $this->_oid = AttributeType::OID_NAME;
27
-        parent::__construct($value, $string_tag);
28
-    }
17
+	/**
18
+	 * Constructor.
19
+	 *
20
+	 * @param string $value      String value
21
+	 * @param int    $string_tag Syntax choice
22
+	 */
23
+	public function __construct(string $value,
24
+		int $string_tag = DirectoryString::UTF8)
25
+	{
26
+		$this->_oid = AttributeType::OID_NAME;
27
+		parent::__construct($value, $string_tag);
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\ASN1\AttributeValue;
6 6
 
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/OrganizationNameValue.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
  */
15 15
 class OrganizationNameValue extends DirectoryString
16 16
 {
17
-    /**
18
-     * Constructor.
19
-     *
20
-     * @param string $value      String value
21
-     * @param int    $string_tag Syntax choice
22
-     */
23
-    public function __construct(string $value,
24
-        int $string_tag = DirectoryString::UTF8)
25
-    {
26
-        $this->_oid = AttributeType::OID_ORGANIZATION_NAME;
27
-        parent::__construct($value, $string_tag);
28
-    }
17
+	/**
18
+	 * Constructor.
19
+	 *
20
+	 * @param string $value      String value
21
+	 * @param int    $string_tag Syntax choice
22
+	 */
23
+	public function __construct(string $value,
24
+		int $string_tag = DirectoryString::UTF8)
25
+	{
26
+		$this->_oid = AttributeType::OID_ORGANIZATION_NAME;
27
+		parent::__construct($value, $string_tag);
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\ASN1\AttributeValue;
6 6
 
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/DescriptionValue.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
  */
15 15
 class DescriptionValue extends DirectoryString
16 16
 {
17
-    /**
18
-     * Constructor.
19
-     *
20
-     * @param string $value      String value
21
-     * @param int    $string_tag Syntax choice
22
-     */
23
-    public function __construct(string $value,
24
-        int $string_tag = DirectoryString::UTF8)
25
-    {
26
-        $this->_oid = AttributeType::OID_DESCRIPTION;
27
-        parent::__construct($value, $string_tag);
28
-    }
17
+	/**
18
+	 * Constructor.
19
+	 *
20
+	 * @param string $value      String value
21
+	 * @param int    $string_tag Syntax choice
22
+	 */
23
+	public function __construct(string $value,
24
+		int $string_tag = DirectoryString::UTF8)
25
+	{
26
+		$this->_oid = AttributeType::OID_DESCRIPTION;
27
+		parent::__construct($value, $string_tag);
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Sop\X501\ASN1\AttributeValue;
6 6
 
Please login to merge, or discard this patch.