Completed
Push — master ( fb1380...d10e8c )
by Joni
04:00
created
lib/X501/ASN1/AttributeValue/GivenNameValue.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 GivenNameValue 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_GIVEN_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_GIVEN_NAME;
28
+		parent::__construct($value, $string_tag);
29
+	}
30 30
 }
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/SerialNumberValue.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
  */
16 16
 class SerialNumberValue extends PrintableStringValue
17 17
 {
18
-    /**
19
-     * Constructor.
20
-     *
21
-     * @param string $value String value
22
-     */
23
-    public function __construct(string $value)
24
-    {
25
-        $this->_oid = AttributeType::OID_SERIAL_NUMBER;
26
-        parent::__construct($value);
27
-    }
18
+	/**
19
+	 * Constructor.
20
+	 *
21
+	 * @param string $value String value
22
+	 */
23
+	public function __construct(string $value)
24
+	{
25
+		$this->_oid = AttributeType::OID_SERIAL_NUMBER;
26
+		parent::__construct($value);
27
+	}
28 28
 }
Please login to merge, or discard this patch.
lib/X501/ASN1/AttributeValue/Feature/PrintableStringValue.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -16,83 +16,83 @@
 block discarded – undo
16 16
  */
17 17
 abstract class PrintableStringValue extends AttributeValue
18 18
 {
19
-    /**
20
-     * String value.
21
-     *
22
-     * @var string $_string
23
-     */
24
-    protected $_string;
19
+	/**
20
+	 * String value.
21
+	 *
22
+	 * @var string $_string
23
+	 */
24
+	protected $_string;
25 25
     
26
-    /**
27
-     * Constructor
28
-     *
29
-     * @param string $value String value
30
-     */
31
-    public function __construct(string $value)
32
-    {
33
-        $this->_string = $value;
34
-    }
26
+	/**
27
+	 * Constructor
28
+	 *
29
+	 * @param string $value String value
30
+	 */
31
+	public function __construct(string $value)
32
+	{
33
+		$this->_string = $value;
34
+	}
35 35
     
36
-    /**
37
-     *
38
-     * @see AttributeValue::fromASN1
39
-     * @param UnspecifiedType $el
40
-     * @return self
41
-     */
42
-    public static function fromASN1(UnspecifiedType $el): self
43
-    {
44
-        return new static($el->asPrintableString()->string());
45
-    }
36
+	/**
37
+	 *
38
+	 * @see AttributeValue::fromASN1
39
+	 * @param UnspecifiedType $el
40
+	 * @return self
41
+	 */
42
+	public static function fromASN1(UnspecifiedType $el): self
43
+	{
44
+		return new static($el->asPrintableString()->string());
45
+	}
46 46
     
47
-    /**
48
-     *
49
-     * @see AttributeValue::toASN1
50
-     * @return PrintableString
51
-     */
52
-    public function toASN1(): PrintableString
53
-    {
54
-        return new PrintableString($this->_string);
55
-    }
47
+	/**
48
+	 *
49
+	 * @see AttributeValue::toASN1
50
+	 * @return PrintableString
51
+	 */
52
+	public function toASN1(): PrintableString
53
+	{
54
+		return new PrintableString($this->_string);
55
+	}
56 56
     
57
-    /**
58
-     *
59
-     * @see AttributeValue::stringValue
60
-     * @return string
61
-     */
62
-    public function stringValue(): string
63
-    {
64
-        return $this->_string;
65
-    }
57
+	/**
58
+	 *
59
+	 * @see AttributeValue::stringValue
60
+	 * @return string
61
+	 */
62
+	public function stringValue(): string
63
+	{
64
+		return $this->_string;
65
+	}
66 66
     
67
-    /**
68
-     *
69
-     * @see AttributeValue::equalityMatchingRule
70
-     * @return CaseIgnoreMatch
71
-     */
72
-    public function equalityMatchingRule()
73
-    {
74
-        // default to caseIgnoreMatch
75
-        return new CaseIgnoreMatch(Element::TYPE_PRINTABLE_STRING);
76
-    }
67
+	/**
68
+	 *
69
+	 * @see AttributeValue::equalityMatchingRule
70
+	 * @return CaseIgnoreMatch
71
+	 */
72
+	public function equalityMatchingRule()
73
+	{
74
+		// default to caseIgnoreMatch
75
+		return new CaseIgnoreMatch(Element::TYPE_PRINTABLE_STRING);
76
+	}
77 77
     
78
-    /**
79
-     *
80
-     * @see AttributeValue::rfc2253String
81
-     * @return string
82
-     */
83
-    public function rfc2253String(): string
84
-    {
85
-        return DNParser::escapeString($this->_transcodedString());
86
-    }
78
+	/**
79
+	 *
80
+	 * @see AttributeValue::rfc2253String
81
+	 * @return string
82
+	 */
83
+	public function rfc2253String(): string
84
+	{
85
+		return DNParser::escapeString($this->_transcodedString());
86
+	}
87 87
     
88
-    /**
89
-     *
90
-     * @see AttributeValue::_transcodedString
91
-     * @return string
92
-     */
93
-    protected function _transcodedString(): string
94
-    {
95
-        // PrintableString maps directly to UTF-8
96
-        return $this->_string;
97
-    }
88
+	/**
89
+	 *
90
+	 * @see AttributeValue::_transcodedString
91
+	 * @return string
92
+	 */
93
+	protected function _transcodedString(): string
94
+	{
95
+		// PrintableString maps directly to UTF-8
96
+		return $this->_string;
97
+	}
98 98
 }
Please login to merge, or discard this patch.
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.