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