Passed
Push — master ( d10e8c...c6bdb0 )
by Joni
03:28
created
lib/X501/ASN1/AttributeValue/AttributeValue.php 2 patches
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -18,157 +18,157 @@
 block discarded – undo
18 18
  */
19 19
 abstract class AttributeValue
20 20
 {
21
-    /**
22
-     * Mapping from attribute type OID to attribute value class name.
23
-     *
24
-     * @internal
25
-     *
26
-     * @var array
27
-     */
28
-    const MAP_OID_TO_CLASS = [
29
-        AttributeType::OID_COMMON_NAME => CommonNameValue::class,
30
-        AttributeType::OID_SURNAME => SurnameValue::class,
31
-        AttributeType::OID_SERIAL_NUMBER => SerialNumberValue::class,
32
-        AttributeType::OID_COUNTRY_NAME => CountryNameValue::class,
33
-        AttributeType::OID_LOCALITY_NAME => LocalityNameValue::class,
34
-        AttributeType::OID_STATE_OR_PROVINCE_NAME => StateOrProvinceNameValue::class,
35
-        AttributeType::OID_ORGANIZATION_NAME => OrganizationNameValue::class,
36
-        AttributeType::OID_ORGANIZATIONAL_UNIT_NAME => OrganizationalUnitNameValue::class,
37
-        AttributeType::OID_TITLE => TitleValue::class,
38
-        AttributeType::OID_DESCRIPTION => DescriptionValue::class,
39
-        AttributeType::OID_NAME => NameValue::class,
40
-        AttributeType::OID_GIVEN_NAME => GivenNameValue::class,
41
-        AttributeType::OID_PSEUDONYM => PseudonymValue::class,
42
-    ];
43
-
44
-    /**
45
-     * OID of the attribute type.
46
-     *
47
-     * @var string
48
-     */
49
-    protected $_oid;
50
-
51
-    /**
52
-     * Get attribute value as an UTF-8 encoded string.
53
-     *
54
-     * @return string
55
-     */
56
-    public function __toString()
57
-    {
58
-        return $this->_transcodedString();
59
-    }
60
-
61
-    /**
62
-     * Generate ASN.1 element.
63
-     *
64
-     * @return Element
65
-     */
66
-    abstract public function toASN1(): Element;
67
-
68
-    /**
69
-     * Get attribute value as a string.
70
-     *
71
-     * @return string
72
-     */
73
-    abstract public function stringValue(): string;
74
-
75
-    /**
76
-     * Get matching rule for equality comparison.
77
-     *
78
-     * @return MatchingRule
79
-     */
80
-    abstract public function equalityMatchingRule(): MatchingRule;
81
-
82
-    /**
83
-     * Get attribute value as a string conforming to RFC 2253.
84
-     *
85
-     * @see https://tools.ietf.org/html/rfc2253#section-2.4
86
-     *
87
-     * @return string
88
-     */
89
-    abstract public function rfc2253String(): string;
90
-
91
-    /**
92
-     * Initialize from ASN.1.
93
-     *
94
-     * @param UnspecifiedType $el
95
-     *
96
-     * @return self
97
-     */
98
-    public static function fromASN1(UnspecifiedType $el): AttributeValue
99
-    {
100
-        throw new \BadMethodCallException(
101
-            'ASN.1 parsing must be implemented in a concrete class.');
102
-    }
103
-
104
-    /**
105
-     * Initialize from ASN.1 with given OID hint.
106
-     *
107
-     * @param string          $oid Attribute's OID
108
-     * @param UnspecifiedType $el
109
-     *
110
-     * @return self
111
-     */
112
-    public static function fromASN1ByOID(string $oid, UnspecifiedType $el): self
113
-    {
114
-        if (!array_key_exists($oid, self::MAP_OID_TO_CLASS)) {
115
-            return new UnknownAttributeValue($oid, $el->asElement());
116
-        }
117
-        $cls = self::MAP_OID_TO_CLASS[$oid];
118
-        return $cls::fromASN1($el);
119
-    }
120
-
121
-    /**
122
-     * Initialize from another AttributeValue.
123
-     *
124
-     * This method is generally used to cast UnknownAttributeValue to
125
-     * specific object when class is declared outside this package.
126
-     *
127
-     * @param self $obj Instance of AttributeValue
128
-     *
129
-     * @return self
130
-     */
131
-    public static function fromSelf(self $obj): self
132
-    {
133
-        return static::fromASN1($obj->toASN1()->asUnspecified());
134
-    }
135
-
136
-    /**
137
-     * Get attribute type's OID.
138
-     *
139
-     * @return string
140
-     */
141
-    public function oid(): string
142
-    {
143
-        return $this->_oid;
144
-    }
145
-
146
-    /**
147
-     * Get Attribute object with this as a single value.
148
-     *
149
-     * @return Attribute
150
-     */
151
-    public function toAttribute(): Attribute
152
-    {
153
-        return Attribute::fromAttributeValues($this);
154
-    }
155
-
156
-    /**
157
-     * Get AttributeTypeAndValue object with this as a value.
158
-     *
159
-     * @return AttributeTypeAndValue
160
-     */
161
-    public function toAttributeTypeAndValue(): AttributeTypeAndValue
162
-    {
163
-        return AttributeTypeAndValue::fromAttributeValue($this);
164
-    }
165
-
166
-    /**
167
-     * Get attribute value as an UTF-8 string conforming to RFC 4518.
168
-     *
169
-     * @see https://tools.ietf.org/html/rfc4518#section-2.1
170
-     *
171
-     * @return string
172
-     */
173
-    abstract protected function _transcodedString(): string;
21
+	/**
22
+	 * Mapping from attribute type OID to attribute value class name.
23
+	 *
24
+	 * @internal
25
+	 *
26
+	 * @var array
27
+	 */
28
+	const MAP_OID_TO_CLASS = [
29
+		AttributeType::OID_COMMON_NAME => CommonNameValue::class,
30
+		AttributeType::OID_SURNAME => SurnameValue::class,
31
+		AttributeType::OID_SERIAL_NUMBER => SerialNumberValue::class,
32
+		AttributeType::OID_COUNTRY_NAME => CountryNameValue::class,
33
+		AttributeType::OID_LOCALITY_NAME => LocalityNameValue::class,
34
+		AttributeType::OID_STATE_OR_PROVINCE_NAME => StateOrProvinceNameValue::class,
35
+		AttributeType::OID_ORGANIZATION_NAME => OrganizationNameValue::class,
36
+		AttributeType::OID_ORGANIZATIONAL_UNIT_NAME => OrganizationalUnitNameValue::class,
37
+		AttributeType::OID_TITLE => TitleValue::class,
38
+		AttributeType::OID_DESCRIPTION => DescriptionValue::class,
39
+		AttributeType::OID_NAME => NameValue::class,
40
+		AttributeType::OID_GIVEN_NAME => GivenNameValue::class,
41
+		AttributeType::OID_PSEUDONYM => PseudonymValue::class,
42
+	];
43
+
44
+	/**
45
+	 * OID of the attribute type.
46
+	 *
47
+	 * @var string
48
+	 */
49
+	protected $_oid;
50
+
51
+	/**
52
+	 * Get attribute value as an UTF-8 encoded string.
53
+	 *
54
+	 * @return string
55
+	 */
56
+	public function __toString()
57
+	{
58
+		return $this->_transcodedString();
59
+	}
60
+
61
+	/**
62
+	 * Generate ASN.1 element.
63
+	 *
64
+	 * @return Element
65
+	 */
66
+	abstract public function toASN1(): Element;
67
+
68
+	/**
69
+	 * Get attribute value as a string.
70
+	 *
71
+	 * @return string
72
+	 */
73
+	abstract public function stringValue(): string;
74
+
75
+	/**
76
+	 * Get matching rule for equality comparison.
77
+	 *
78
+	 * @return MatchingRule
79
+	 */
80
+	abstract public function equalityMatchingRule(): MatchingRule;
81
+
82
+	/**
83
+	 * Get attribute value as a string conforming to RFC 2253.
84
+	 *
85
+	 * @see https://tools.ietf.org/html/rfc2253#section-2.4
86
+	 *
87
+	 * @return string
88
+	 */
89
+	abstract public function rfc2253String(): string;
90
+
91
+	/**
92
+	 * Initialize from ASN.1.
93
+	 *
94
+	 * @param UnspecifiedType $el
95
+	 *
96
+	 * @return self
97
+	 */
98
+	public static function fromASN1(UnspecifiedType $el): AttributeValue
99
+	{
100
+		throw new \BadMethodCallException(
101
+			'ASN.1 parsing must be implemented in a concrete class.');
102
+	}
103
+
104
+	/**
105
+	 * Initialize from ASN.1 with given OID hint.
106
+	 *
107
+	 * @param string          $oid Attribute's OID
108
+	 * @param UnspecifiedType $el
109
+	 *
110
+	 * @return self
111
+	 */
112
+	public static function fromASN1ByOID(string $oid, UnspecifiedType $el): self
113
+	{
114
+		if (!array_key_exists($oid, self::MAP_OID_TO_CLASS)) {
115
+			return new UnknownAttributeValue($oid, $el->asElement());
116
+		}
117
+		$cls = self::MAP_OID_TO_CLASS[$oid];
118
+		return $cls::fromASN1($el);
119
+	}
120
+
121
+	/**
122
+	 * Initialize from another AttributeValue.
123
+	 *
124
+	 * This method is generally used to cast UnknownAttributeValue to
125
+	 * specific object when class is declared outside this package.
126
+	 *
127
+	 * @param self $obj Instance of AttributeValue
128
+	 *
129
+	 * @return self
130
+	 */
131
+	public static function fromSelf(self $obj): self
132
+	{
133
+		return static::fromASN1($obj->toASN1()->asUnspecified());
134
+	}
135
+
136
+	/**
137
+	 * Get attribute type's OID.
138
+	 *
139
+	 * @return string
140
+	 */
141
+	public function oid(): string
142
+	{
143
+		return $this->_oid;
144
+	}
145
+
146
+	/**
147
+	 * Get Attribute object with this as a single value.
148
+	 *
149
+	 * @return Attribute
150
+	 */
151
+	public function toAttribute(): Attribute
152
+	{
153
+		return Attribute::fromAttributeValues($this);
154
+	}
155
+
156
+	/**
157
+	 * Get AttributeTypeAndValue object with this as a value.
158
+	 *
159
+	 * @return AttributeTypeAndValue
160
+	 */
161
+	public function toAttributeTypeAndValue(): AttributeTypeAndValue
162
+	{
163
+		return AttributeTypeAndValue::fromAttributeValue($this);
164
+	}
165
+
166
+	/**
167
+	 * Get attribute value as an UTF-8 string conforming to RFC 4518.
168
+	 *
169
+	 * @see https://tools.ietf.org/html/rfc4518#section-2.1
170
+	 *
171
+	 * @return string
172
+	 */
173
+	abstract protected function _transcodedString(): string;
174 174
 }
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/CommonNameValue.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 CommonNameValue 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_COMMON_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_COMMON_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/TitleValue.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 TitleValue 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_TITLE;
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_TITLE;
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/Feature/DirectoryString.php 2 patches
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\Feature;
6 6
 
Please login to merge, or discard this patch.
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -24,156 +24,156 @@
 block discarded – undo
24 24
  */
25 25
 abstract class DirectoryString extends AttributeValue
26 26
 {
27
-    /**
28
-     * Teletex string syntax.
29
-     *
30
-     * @var int
31
-     */
32
-    const TELETEX = Element::TYPE_T61_STRING;
33
-
34
-    /**
35
-     * Printable string syntax.
36
-     *
37
-     * @var int
38
-     */
39
-    const PRINTABLE = Element::TYPE_PRINTABLE_STRING;
40
-
41
-    /**
42
-     * BMP string syntax.
43
-     *
44
-     * @var int
45
-     */
46
-    const BMP = Element::TYPE_BMP_STRING;
47
-
48
-    /**
49
-     * Universal string syntax.
50
-     *
51
-     * @var int
52
-     */
53
-    const UNIVERSAL = Element::TYPE_UNIVERSAL_STRING;
54
-
55
-    /**
56
-     * UTF-8 string syntax.
57
-     *
58
-     * @var int
59
-     */
60
-    const UTF8 = Element::TYPE_UTF8_STRING;
61
-
62
-    /**
63
-     * Mapping from syntax enumeration to ASN.1 class name.
64
-     *
65
-     * @internal
66
-     *
67
-     * @var array
68
-     */
69
-    const MAP_TAG_TO_CLASS = [
70
-        self::TELETEX => T61String::class,
71
-        self::PRINTABLE => PrintableString::class,
72
-        self::UNIVERSAL => UniversalString::class,
73
-        self::UTF8 => UTF8String::class,
74
-        self::BMP => BMPString::class,
75
-    ];
76
-
77
-    /**
78
-     * ASN.1 type tag for the chosen syntax.
79
-     *
80
-     * @var int
81
-     */
82
-    protected $_stringTag;
83
-
84
-    /**
85
-     * String value.
86
-     *
87
-     * @var string
88
-     */
89
-    protected $_string;
90
-
91
-    /**
92
-     * Constructor.
93
-     *
94
-     * @param string $value      String value
95
-     * @param int    $string_tag Syntax choice
96
-     */
97
-    public function __construct(string $value, int $string_tag)
98
-    {
99
-        $this->_string = $value;
100
-        $this->_stringTag = $string_tag;
101
-    }
102
-
103
-    /**
104
-     * {@inheritdoc}
105
-     *
106
-     * @return self
107
-     */
108
-    public static function fromASN1(UnspecifiedType $el): AttributeValue
109
-    {
110
-        $tag = $el->tag();
111
-        self::_tagToASN1Class($tag);
112
-        return new static($el->asString()->string(), $tag);
113
-    }
114
-
115
-    /**
116
-     * {@inheritdoc}
117
-     */
118
-    public function toASN1(): Element
119
-    {
120
-        $cls = self::_tagToASN1Class($this->_stringTag);
121
-        return new $cls($this->_string);
122
-    }
123
-
124
-    /**
125
-     * {@inheritdoc}
126
-     */
127
-    public function stringValue(): string
128
-    {
129
-        return $this->_string;
130
-    }
131
-
132
-    /**
133
-     * {@inheritdoc}
134
-     */
135
-    public function equalityMatchingRule(): MatchingRule
136
-    {
137
-        return new CaseIgnoreMatch($this->_stringTag);
138
-    }
139
-
140
-    /**
141
-     * {@inheritdoc}
142
-     */
143
-    public function rfc2253String(): string
144
-    {
145
-        // TeletexString is encoded as binary
146
-        if (self::TELETEX === $this->_stringTag) {
147
-            return $this->_transcodedString();
148
-        }
149
-        return DNParser::escapeString($this->_transcodedString());
150
-    }
151
-
152
-    /**
153
-     * {@inheritdoc}
154
-     */
155
-    protected function _transcodedString(): string
156
-    {
157
-        $step = new TranscodeStep($this->_stringTag);
158
-        return $step->apply($this->_string);
159
-    }
160
-
161
-    /**
162
-     * Get ASN.1 class name for given DirectoryString type tag.
163
-     *
164
-     * @param int $tag
165
-     *
166
-     * @throws \UnexpectedValueException
167
-     *
168
-     * @return string
169
-     */
170
-    private static function _tagToASN1Class(int $tag): string
171
-    {
172
-        if (!array_key_exists($tag, self::MAP_TAG_TO_CLASS)) {
173
-            throw new \UnexpectedValueException(
174
-                'Type ' . Element::tagToName($tag) .
175
-                ' is not valid DirectoryString.');
176
-        }
177
-        return self::MAP_TAG_TO_CLASS[$tag];
178
-    }
27
+	/**
28
+	 * Teletex string syntax.
29
+	 *
30
+	 * @var int
31
+	 */
32
+	const TELETEX = Element::TYPE_T61_STRING;
33
+
34
+	/**
35
+	 * Printable string syntax.
36
+	 *
37
+	 * @var int
38
+	 */
39
+	const PRINTABLE = Element::TYPE_PRINTABLE_STRING;
40
+
41
+	/**
42
+	 * BMP string syntax.
43
+	 *
44
+	 * @var int
45
+	 */
46
+	const BMP = Element::TYPE_BMP_STRING;
47
+
48
+	/**
49
+	 * Universal string syntax.
50
+	 *
51
+	 * @var int
52
+	 */
53
+	const UNIVERSAL = Element::TYPE_UNIVERSAL_STRING;
54
+
55
+	/**
56
+	 * UTF-8 string syntax.
57
+	 *
58
+	 * @var int
59
+	 */
60
+	const UTF8 = Element::TYPE_UTF8_STRING;
61
+
62
+	/**
63
+	 * Mapping from syntax enumeration to ASN.1 class name.
64
+	 *
65
+	 * @internal
66
+	 *
67
+	 * @var array
68
+	 */
69
+	const MAP_TAG_TO_CLASS = [
70
+		self::TELETEX => T61String::class,
71
+		self::PRINTABLE => PrintableString::class,
72
+		self::UNIVERSAL => UniversalString::class,
73
+		self::UTF8 => UTF8String::class,
74
+		self::BMP => BMPString::class,
75
+	];
76
+
77
+	/**
78
+	 * ASN.1 type tag for the chosen syntax.
79
+	 *
80
+	 * @var int
81
+	 */
82
+	protected $_stringTag;
83
+
84
+	/**
85
+	 * String value.
86
+	 *
87
+	 * @var string
88
+	 */
89
+	protected $_string;
90
+
91
+	/**
92
+	 * Constructor.
93
+	 *
94
+	 * @param string $value      String value
95
+	 * @param int    $string_tag Syntax choice
96
+	 */
97
+	public function __construct(string $value, int $string_tag)
98
+	{
99
+		$this->_string = $value;
100
+		$this->_stringTag = $string_tag;
101
+	}
102
+
103
+	/**
104
+	 * {@inheritdoc}
105
+	 *
106
+	 * @return self
107
+	 */
108
+	public static function fromASN1(UnspecifiedType $el): AttributeValue
109
+	{
110
+		$tag = $el->tag();
111
+		self::_tagToASN1Class($tag);
112
+		return new static($el->asString()->string(), $tag);
113
+	}
114
+
115
+	/**
116
+	 * {@inheritdoc}
117
+	 */
118
+	public function toASN1(): Element
119
+	{
120
+		$cls = self::_tagToASN1Class($this->_stringTag);
121
+		return new $cls($this->_string);
122
+	}
123
+
124
+	/**
125
+	 * {@inheritdoc}
126
+	 */
127
+	public function stringValue(): string
128
+	{
129
+		return $this->_string;
130
+	}
131
+
132
+	/**
133
+	 * {@inheritdoc}
134
+	 */
135
+	public function equalityMatchingRule(): MatchingRule
136
+	{
137
+		return new CaseIgnoreMatch($this->_stringTag);
138
+	}
139
+
140
+	/**
141
+	 * {@inheritdoc}
142
+	 */
143
+	public function rfc2253String(): string
144
+	{
145
+		// TeletexString is encoded as binary
146
+		if (self::TELETEX === $this->_stringTag) {
147
+			return $this->_transcodedString();
148
+		}
149
+		return DNParser::escapeString($this->_transcodedString());
150
+	}
151
+
152
+	/**
153
+	 * {@inheritdoc}
154
+	 */
155
+	protected function _transcodedString(): string
156
+	{
157
+		$step = new TranscodeStep($this->_stringTag);
158
+		return $step->apply($this->_string);
159
+	}
160
+
161
+	/**
162
+	 * Get ASN.1 class name for given DirectoryString type tag.
163
+	 *
164
+	 * @param int $tag
165
+	 *
166
+	 * @throws \UnexpectedValueException
167
+	 *
168
+	 * @return string
169
+	 */
170
+	private static function _tagToASN1Class(int $tag): string
171
+	{
172
+		if (!array_key_exists($tag, self::MAP_TAG_TO_CLASS)) {
173
+			throw new \UnexpectedValueException(
174
+				'Type ' . Element::tagToName($tag) .
175
+				' is not valid DirectoryString.');
176
+		}
177
+		return self::MAP_TAG_TO_CLASS[$tag];
178
+	}
179 179
 }
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/Feature/PrintableStringValue.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -17,72 +17,72 @@
 block discarded – undo
17 17
  */
18 18
 abstract class PrintableStringValue extends AttributeValue
19 19
 {
20
-    /**
21
-     * String value.
22
-     *
23
-     * @var string
24
-     */
25
-    protected $_string;
20
+	/**
21
+	 * String value.
22
+	 *
23
+	 * @var string
24
+	 */
25
+	protected $_string;
26 26
 
27
-    /**
28
-     * Constructor.
29
-     *
30
-     * @param string $value String value
31
-     */
32
-    public function __construct(string $value)
33
-    {
34
-        $this->_string = $value;
35
-    }
27
+	/**
28
+	 * Constructor.
29
+	 *
30
+	 * @param string $value String value
31
+	 */
32
+	public function __construct(string $value)
33
+	{
34
+		$this->_string = $value;
35
+	}
36 36
 
37
-    /**
38
-     * {@inheritdoc}
39
-     *
40
-     * @return self
41
-     */
42
-    public static function fromASN1(UnspecifiedType $el): AttributeValue
43
-    {
44
-        return new static($el->asPrintableString()->string());
45
-    }
37
+	/**
38
+	 * {@inheritdoc}
39
+	 *
40
+	 * @return self
41
+	 */
42
+	public static function fromASN1(UnspecifiedType $el): AttributeValue
43
+	{
44
+		return new static($el->asPrintableString()->string());
45
+	}
46 46
 
47
-    /**
48
-     * {@inheritdoc}
49
-     */
50
-    public function toASN1(): Element
51
-    {
52
-        return new PrintableString($this->_string);
53
-    }
47
+	/**
48
+	 * {@inheritdoc}
49
+	 */
50
+	public function toASN1(): Element
51
+	{
52
+		return new PrintableString($this->_string);
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritdoc}
57
-     */
58
-    public function stringValue(): string
59
-    {
60
-        return $this->_string;
61
-    }
55
+	/**
56
+	 * {@inheritdoc}
57
+	 */
58
+	public function stringValue(): string
59
+	{
60
+		return $this->_string;
61
+	}
62 62
 
63
-    /**
64
-     * {@inheritdoc}
65
-     */
66
-    public function equalityMatchingRule(): MatchingRule
67
-    {
68
-        // default to caseIgnoreMatch
69
-        return new CaseIgnoreMatch(Element::TYPE_PRINTABLE_STRING);
70
-    }
63
+	/**
64
+	 * {@inheritdoc}
65
+	 */
66
+	public function equalityMatchingRule(): MatchingRule
67
+	{
68
+		// default to caseIgnoreMatch
69
+		return new CaseIgnoreMatch(Element::TYPE_PRINTABLE_STRING);
70
+	}
71 71
 
72
-    /**
73
-     * {@inheritdoc}
74
-     */
75
-    public function rfc2253String(): string
76
-    {
77
-        return DNParser::escapeString($this->_transcodedString());
78
-    }
72
+	/**
73
+	 * {@inheritdoc}
74
+	 */
75
+	public function rfc2253String(): string
76
+	{
77
+		return DNParser::escapeString($this->_transcodedString());
78
+	}
79 79
 
80
-    /**
81
-     * {@inheritdoc}
82
-     */
83
-    protected function _transcodedString(): string
84
-    {
85
-        // PrintableString maps directly to UTF-8
86
-        return $this->_string;
87
-    }
80
+	/**
81
+	 * {@inheritdoc}
82
+	 */
83
+	protected function _transcodedString(): string
84
+	{
85
+		// PrintableString maps directly to UTF-8
86
+		return $this->_string;
87
+	}
88 88
 }
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\Feature;
6 6
 
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/SurnameValue.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 SurnameValue 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_SURNAME;
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_SURNAME;
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/UnknownAttributeValue.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -13,63 +13,63 @@
 block discarded – undo
13 13
  */
14 14
 class UnknownAttributeValue extends AttributeValue
15 15
 {
16
-    /**
17
-     * ASN.1 element.
18
-     *
19
-     * @var Element
20
-     */
21
-    protected $_element;
16
+	/**
17
+	 * ASN.1 element.
18
+	 *
19
+	 * @var Element
20
+	 */
21
+	protected $_element;
22 22
 
23
-    /**
24
-     * Constructor.
25
-     *
26
-     * @param string  $oid
27
-     * @param Element $el
28
-     */
29
-    public function __construct(string $oid, Element $el)
30
-    {
31
-        $this->_oid = $oid;
32
-        $this->_element = $el;
33
-    }
23
+	/**
24
+	 * Constructor.
25
+	 *
26
+	 * @param string  $oid
27
+	 * @param Element $el
28
+	 */
29
+	public function __construct(string $oid, Element $el)
30
+	{
31
+		$this->_oid = $oid;
32
+		$this->_element = $el;
33
+	}
34 34
 
35
-    /**
36
-     * {@inheritdoc}
37
-     */
38
-    public function toASN1(): Element
39
-    {
40
-        return $this->_element;
41
-    }
35
+	/**
36
+	 * {@inheritdoc}
37
+	 */
38
+	public function toASN1(): Element
39
+	{
40
+		return $this->_element;
41
+	}
42 42
 
43
-    /**
44
-     * {@inheritdoc}
45
-     */
46
-    public function stringValue(): string
47
-    {
48
-        // return DER encoding as a hexstring
49
-        return '#' . bin2hex($this->_element->toDER());
50
-    }
43
+	/**
44
+	 * {@inheritdoc}
45
+	 */
46
+	public function stringValue(): string
47
+	{
48
+		// return DER encoding as a hexstring
49
+		return '#' . bin2hex($this->_element->toDER());
50
+	}
51 51
 
52
-    /**
53
-     * {@inheritdoc}
54
-     */
55
-    public function equalityMatchingRule(): MatchingRule
56
-    {
57
-        return new BinaryMatch();
58
-    }
52
+	/**
53
+	 * {@inheritdoc}
54
+	 */
55
+	public function equalityMatchingRule(): MatchingRule
56
+	{
57
+		return new BinaryMatch();
58
+	}
59 59
 
60
-    /**
61
-     * {@inheritdoc}
62
-     */
63
-    public function rfc2253String(): string
64
-    {
65
-        return $this->stringValue();
66
-    }
60
+	/**
61
+	 * {@inheritdoc}
62
+	 */
63
+	public function rfc2253String(): string
64
+	{
65
+		return $this->stringValue();
66
+	}
67 67
 
68
-    /**
69
-     * {@inheritdoc}
70
-     */
71
-    protected function _transcodedString(): string
72
-    {
73
-        return $this->stringValue();
74
-    }
68
+	/**
69
+	 * {@inheritdoc}
70
+	 */
71
+	protected function _transcodedString(): string
72
+	{
73
+		return $this->stringValue();
74
+	}
75 75
 }
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/PseudonymValue.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 PseudonymValue 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_PSEUDONYM;
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_PSEUDONYM;
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/StateOrProvinceNameValue.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 StateOrProvinceNameValue 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_STATE_OR_PROVINCE_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_STATE_OR_PROVINCE_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.