|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace AlgoWeb\ODataMetadata\Util; |
|
6
|
|
|
|
|
7
|
|
|
class XmlCharType |
|
8
|
|
|
{ |
|
9
|
|
|
#region "Constants" |
|
10
|
|
|
// Characters defined in the XML 1.0 Fourth Edition |
|
11
|
|
|
// Whitespace chars -- Section 2.3 [3] |
|
12
|
|
|
// Letters -- Appendix B [84] |
|
13
|
|
|
// Starting NCName characters -- Section 2.3 [5] (Starting Name characters without ':') |
|
14
|
|
|
// NCName characters -- Section 2.3 [4] (Name characters without ':') |
|
15
|
|
|
// Character data characters -- Section 2.2 [2] |
|
16
|
|
|
// PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] Section 2.3 of spec |
|
17
|
|
|
protected const fWhitespace = 1; |
|
18
|
|
|
protected const fLetter = 2; |
|
19
|
|
|
protected const fNCStartNameSC = 4; |
|
20
|
|
|
protected const fNCNameSC = 8; |
|
21
|
|
|
protected const fCharData = 16; |
|
22
|
|
|
protected const fNCNameXml4e = 32; |
|
23
|
|
|
protected const fText = 64; |
|
24
|
|
|
protected const fAttrValue = 128; |
|
25
|
|
|
|
|
26
|
|
|
protected const s_Whitespace = |
|
27
|
|
|
"\u{0009}\u{000a}\u{000d}\u{000d} "; |
|
28
|
|
|
// XML 1.0 Fourth Edition definitions for name characters |
|
29
|
|
|
// |
|
30
|
|
|
protected const s_LetterXml4e = |
|
31
|
|
|
"\u{0041}\u{005a}\u{0061}\u{007a}\u{00c0}\u{00d6}\u{00d8}\u{00f6}" . |
|
32
|
|
|
"\u{00f8}\u{0131}\u{0134}\u{013e}\u{0141}\u{0148}\u{014a}\u{017e}" . |
|
33
|
|
|
"\u{0180}\u{01c3}\u{01cd}\u{01f0}\u{01f4}\u{01f5}\u{01fa}\u{0217}" . |
|
34
|
|
|
"\u{0250}\u{02a8}\u{02bb}\u{02c1}\u{0386}\u{0386}\u{0388}\u{038a}" . |
|
35
|
|
|
"\u{038c}\u{038c}\u{038e}\u{03a1}\u{03a3}\u{03ce}\u{03d0}\u{03d6}" . |
|
36
|
|
|
"\u{03da}\u{03da}\u{03dc}\u{03dc}\u{03de}\u{03de}\u{03e0}\u{03e0}" . |
|
37
|
|
|
"\u{03e2}\u{03f3}\u{0401}\u{040c}\u{040e}\u{044f}\u{0451}\u{045c}" . |
|
38
|
|
|
"\u{045e}\u{0481}\u{0490}\u{04c4}\u{04c7}\u{04c8}\u{04cb}\u{04cc}" . |
|
39
|
|
|
"\u{04d0}\u{04eb}\u{04ee}\u{04f5}\u{04f8}\u{04f9}\u{0531}\u{0556}" . |
|
40
|
|
|
"\u{0559}\u{0559}\u{0561}\u{0586}\u{05d0}\u{05ea}\u{05f0}\u{05f2}" . |
|
41
|
|
|
"\u{0621}\u{063a}\u{0641}\u{064a}\u{0671}\u{06b7}\u{06ba}\u{06be}" . |
|
42
|
|
|
"\u{06c0}\u{06ce}\u{06d0}\u{06d3}\u{06d5}\u{06d5}\u{06e5}\u{06e6}" . |
|
43
|
|
|
"\u{0905}\u{0939}\u{093d}\u{093d}\u{0958}\u{0961}\u{0985}\u{098c}" . |
|
44
|
|
|
"\u{098f}\u{0990}\u{0993}\u{09a8}\u{09aa}\u{09b0}\u{09b2}\u{09b2}" . |
|
45
|
|
|
"\u{09b6}\u{09b9}\u{09dc}\u{09dd}\u{09df}\u{09e1}\u{09f0}\u{09f1}" . |
|
46
|
|
|
"\u{0a05}\u{0a0a}\u{0a0f}\u{0a10}\u{0a13}\u{0a28}\u{0a2a}\u{0a30}" . |
|
47
|
|
|
"\u{0a32}\u{0a33}\u{0a35}\u{0a36}\u{0a38}\u{0a39}\u{0a59}\u{0a5c}" . |
|
48
|
|
|
"\u{0a5e}\u{0a5e}\u{0a72}\u{0a74}\u{0a85}\u{0a8b}\u{0a8d}\u{0a8d}" . |
|
49
|
|
|
"\u{0a8f}\u{0a91}\u{0a93}\u{0aa8}\u{0aaa}\u{0ab0}\u{0ab2}\u{0ab3}" . |
|
50
|
|
|
"\u{0ab5}\u{0ab9}\u{0abd}\u{0abd}\u{0ae0}\u{0ae0}\u{0b05}\u{0b0c}" . |
|
51
|
|
|
"\u{0b0f}\u{0b10}\u{0b13}\u{0b28}\u{0b2a}\u{0b30}\u{0b32}\u{0b33}" . |
|
52
|
|
|
"\u{0b36}\u{0b39}\u{0b3d}\u{0b3d}\u{0b5c}\u{0b5d}\u{0b5f}\u{0b61}" . |
|
53
|
|
|
"\u{0b85}\u{0b8a}\u{0b8e}\u{0b90}\u{0b92}\u{0b95}\u{0b99}\u{0b9a}" . |
|
54
|
|
|
"\u{0b9c}\u{0b9c}\u{0b9e}\u{0b9f}\u{0ba3}\u{0ba4}\u{0ba8}\u{0baa}" . |
|
55
|
|
|
"\u{0bae}\u{0bb5}\u{0bb7}\u{0bb9}\u{0c05}\u{0c0c}\u{0c0e}\u{0c10}" . |
|
56
|
|
|
"\u{0c12}\u{0c28}\u{0c2a}\u{0c33}\u{0c35}\u{0c39}\u{0c60}\u{0c61}" . |
|
57
|
|
|
"\u{0c85}\u{0c8c}\u{0c8e}\u{0c90}\u{0c92}\u{0ca8}\u{0caa}\u{0cb3}" . |
|
58
|
|
|
"\u{0cb5}\u{0cb9}\u{0cde}\u{0cde}\u{0ce0}\u{0ce1}\u{0d05}\u{0d0c}" . |
|
59
|
|
|
"\u{0d0e}\u{0d10}\u{0d12}\u{0d28}\u{0d2a}\u{0d39}\u{0d60}\u{0d61}" . |
|
60
|
|
|
"\u{0e01}\u{0e2e}\u{0e30}\u{0e30}\u{0e32}\u{0e33}\u{0e40}\u{0e45}" . |
|
61
|
|
|
"\u{0e81}\u{0e82}\u{0e84}\u{0e84}\u{0e87}\u{0e88}\u{0e8a}\u{0e8a}" . |
|
62
|
|
|
"\u{0e8d}\u{0e8d}\u{0e94}\u{0e97}\u{0e99}\u{0e9f}\u{0ea1}\u{0ea3}" . |
|
63
|
|
|
"\u{0ea5}\u{0ea5}\u{0ea7}\u{0ea7}\u{0eaa}\u{0eab}\u{0ead}\u{0eae}" . |
|
64
|
|
|
"\u{0eb0}\u{0eb0}\u{0eb2}\u{0eb3}\u{0ebd}\u{0ebd}\u{0ec0}\u{0ec4}" . |
|
65
|
|
|
"\u{0f40}\u{0f47}\u{0f49}\u{0f69}\u{10a0}\u{10c5}\u{10d0}\u{10f6}" . |
|
66
|
|
|
"\u{1100}\u{1100}\u{1102}\u{1103}\u{1105}\u{1107}\u{1109}\u{1109}" . |
|
67
|
|
|
"\u{110b}\u{110c}\u{110e}\u{1112}\u{113c}\u{113c}\u{113e}\u{113e}" . |
|
68
|
|
|
"\u{1140}\u{1140}\u{114c}\u{114c}\u{114e}\u{114e}\u{1150}\u{1150}" . |
|
69
|
|
|
"\u{1154}\u{1155}\u{1159}\u{1159}\u{115f}\u{1161}\u{1163}\u{1163}" . |
|
70
|
|
|
"\u{1165}\u{1165}\u{1167}\u{1167}\u{1169}\u{1169}\u{116d}\u{116e}" . |
|
71
|
|
|
"\u{1172}\u{1173}\u{1175}\u{1175}\u{119e}\u{119e}\u{11a8}\u{11a8}" . |
|
72
|
|
|
"\u{11ab}\u{11ab}\u{11ae}\u{11af}\u{11b7}\u{11b8}\u{11ba}\u{11ba}" . |
|
73
|
|
|
"\u{11bc}\u{11c2}\u{11eb}\u{11eb}\u{11f0}\u{11f0}\u{11f9}\u{11f9}" . |
|
74
|
|
|
"\u{1e00}\u{1e9b}\u{1ea0}\u{1ef9}\u{1f00}\u{1f15}\u{1f18}\u{1f1d}" . |
|
75
|
|
|
"\u{1f20}\u{1f45}\u{1f48}\u{1f4d}\u{1f50}\u{1f57}\u{1f59}\u{1f59}" . |
|
76
|
|
|
"\u{1f5b}\u{1f5b}\u{1f5d}\u{1f5d}\u{1f5f}\u{1f7d}\u{1f80}\u{1fb4}" . |
|
77
|
|
|
"\u{1fb6}\u{1fbc}\u{1fbe}\u{1fbe}\u{1fc2}\u{1fc4}\u{1fc6}\u{1fcc}" . |
|
78
|
|
|
"\u{1fd0}\u{1fd3}\u{1fd6}\u{1fdb}\u{1fe0}\u{1fec}\u{1ff2}\u{1ff4}" . |
|
79
|
|
|
"\u{1ff6}\u{1ffc}\u{2126}\u{2126}\u{212a}\u{212b}\u{212e}\u{212e}" . |
|
80
|
|
|
"\u{2180}\u{2182}\u{3007}\u{3007}\u{3021}\u{3029}\u{3041}\u{3094}" . |
|
81
|
|
|
"\u{30a1}\u{30fa}\u{3105}\u{312c}\u{4e00}\u{9fa5}\u{ac00}\u{d7a3}"; |
|
82
|
|
|
|
|
83
|
|
|
protected const s_NCStartName = |
|
84
|
|
|
"\u{0041}\u{005a}\u{005f}\u{005f}\u{0061}\u{007a}" . |
|
85
|
|
|
"\u{00c0}\u{00d6}\u{00d8}\u{00f6}\u{00f8}\u{0131}\u{0134}\u{013e}" . |
|
86
|
|
|
"\u{0141}\u{0148}\u{014a}\u{017e}\u{0180}\u{01c3}\u{01cd}\u{01f0}" . |
|
87
|
|
|
"\u{01f4}\u{01f5}\u{01fa}\u{0217}\u{0250}\u{02a8}\u{02bb}\u{02c1}" . |
|
88
|
|
|
"\u{0386}\u{0386}\u{0388}\u{038a}\u{038c}\u{038c}\u{038e}\u{03a1}" . |
|
89
|
|
|
"\u{03a3}\u{03ce}\u{03d0}\u{03d6}\u{03da}\u{03da}\u{03dc}\u{03dc}" . |
|
90
|
|
|
"\u{03de}\u{03de}\u{03e0}\u{03e0}\u{03e2}\u{03f3}\u{0401}\u{040c}" . |
|
91
|
|
|
"\u{040e}\u{044f}\u{0451}\u{045c}\u{045e}\u{0481}\u{0490}\u{04c4}" . |
|
92
|
|
|
"\u{04c7}\u{04c8}\u{04cb}\u{04cc}\u{04d0}\u{04eb}\u{04ee}\u{04f5}" . |
|
93
|
|
|
"\u{04f8}\u{04f9}\u{0531}\u{0556}\u{0559}\u{0559}\u{0561}\u{0586}" . |
|
94
|
|
|
"\u{05d0}\u{05ea}\u{05f0}\u{05f2}\u{0621}\u{063a}\u{0641}\u{064a}" . |
|
95
|
|
|
"\u{0671}\u{06b7}\u{06ba}\u{06be}\u{06c0}\u{06ce}\u{06d0}\u{06d3}" . |
|
96
|
|
|
"\u{06d5}\u{06d5}\u{06e5}\u{06e6}\u{0905}\u{0939}\u{093d}\u{093d}" . |
|
97
|
|
|
"\u{0958}\u{0961}\u{0985}\u{098c}\u{098f}\u{0990}\u{0993}\u{09a8}" . |
|
98
|
|
|
"\u{09aa}\u{09b0}\u{09b2}\u{09b2}\u{09b6}\u{09b9}\u{09dc}\u{09dd}" . |
|
99
|
|
|
"\u{09df}\u{09e1}\u{09f0}\u{09f1}\u{0a05}\u{0a0a}\u{0a0f}\u{0a10}" . |
|
100
|
|
|
"\u{0a13}\u{0a28}\u{0a2a}\u{0a30}\u{0a32}\u{0a33}\u{0a35}\u{0a36}" . |
|
101
|
|
|
"\u{0a38}\u{0a39}\u{0a59}\u{0a5c}\u{0a5e}\u{0a5e}\u{0a72}\u{0a74}" . |
|
102
|
|
|
"\u{0a85}\u{0a8b}\u{0a8d}\u{0a8d}\u{0a8f}\u{0a91}\u{0a93}\u{0aa8}" . |
|
103
|
|
|
"\u{0aaa}\u{0ab0}\u{0ab2}\u{0ab3}\u{0ab5}\u{0ab9}\u{0abd}\u{0abd}" . |
|
104
|
|
|
"\u{0ae0}\u{0ae0}\u{0b05}\u{0b0c}\u{0b0f}\u{0b10}\u{0b13}\u{0b28}" . |
|
105
|
|
|
"\u{0b2a}\u{0b30}\u{0b32}\u{0b33}\u{0b36}\u{0b39}\u{0b3d}\u{0b3d}" . |
|
106
|
|
|
"\u{0b5c}\u{0b5d}\u{0b5f}\u{0b61}\u{0b85}\u{0b8a}\u{0b8e}\u{0b90}" . |
|
107
|
|
|
"\u{0b92}\u{0b95}\u{0b99}\u{0b9a}\u{0b9c}\u{0b9c}\u{0b9e}\u{0b9f}" . |
|
108
|
|
|
"\u{0ba3}\u{0ba4}\u{0ba8}\u{0baa}\u{0bae}\u{0bb5}\u{0bb7}\u{0bb9}" . |
|
109
|
|
|
"\u{0c05}\u{0c0c}\u{0c0e}\u{0c10}\u{0c12}\u{0c28}\u{0c2a}\u{0c33}" . |
|
110
|
|
|
"\u{0c35}\u{0c39}\u{0c60}\u{0c61}\u{0c85}\u{0c8c}\u{0c8e}\u{0c90}" . |
|
111
|
|
|
"\u{0c92}\u{0ca8}\u{0caa}\u{0cb3}\u{0cb5}\u{0cb9}\u{0cde}\u{0cde}" . |
|
112
|
|
|
"\u{0ce0}\u{0ce1}\u{0d05}\u{0d0c}\u{0d0e}\u{0d10}\u{0d12}\u{0d28}" . |
|
113
|
|
|
"\u{0d2a}\u{0d39}\u{0d60}\u{0d61}\u{0e01}\u{0e2e}\u{0e30}\u{0e30}" . |
|
114
|
|
|
"\u{0e32}\u{0e33}\u{0e40}\u{0e45}\u{0e81}\u{0e82}\u{0e84}\u{0e84}" . |
|
115
|
|
|
"\u{0e87}\u{0e88}\u{0e8a}\u{0e8a}\u{0e8d}\u{0e8d}\u{0e94}\u{0e97}" . |
|
116
|
|
|
"\u{0e99}\u{0e9f}\u{0ea1}\u{0ea3}\u{0ea5}\u{0ea5}\u{0ea7}\u{0ea7}" . |
|
117
|
|
|
"\u{0eaa}\u{0eab}\u{0ead}\u{0eae}\u{0eb0}\u{0eb0}\u{0eb2}\u{0eb3}" . |
|
118
|
|
|
"\u{0ebd}\u{0ebd}\u{0ec0}\u{0ec4}\u{0f40}\u{0f47}\u{0f49}\u{0f69}" . |
|
119
|
|
|
"\u{10a0}\u{10c5}\u{10d0}\u{10f6}\u{1100}\u{1100}\u{1102}\u{1103}" . |
|
120
|
|
|
"\u{1105}\u{1107}\u{1109}\u{1109}\u{110b}\u{110c}\u{110e}\u{1112}" . |
|
121
|
|
|
"\u{113c}\u{113c}\u{113e}\u{113e}\u{1140}\u{1140}\u{114c}\u{114c}" . |
|
122
|
|
|
"\u{114e}\u{114e}\u{1150}\u{1150}\u{1154}\u{1155}\u{1159}\u{1159}" . |
|
123
|
|
|
"\u{115f}\u{1161}\u{1163}\u{1163}\u{1165}\u{1165}\u{1167}\u{1167}" . |
|
124
|
|
|
"\u{1169}\u{1169}\u{116d}\u{116e}\u{1172}\u{1173}\u{1175}\u{1175}" . |
|
125
|
|
|
"\u{119e}\u{119e}\u{11a8}\u{11a8}\u{11ab}\u{11ab}\u{11ae}\u{11af}" . |
|
126
|
|
|
"\u{11b7}\u{11b8}\u{11ba}\u{11ba}\u{11bc}\u{11c2}\u{11eb}\u{11eb}" . |
|
127
|
|
|
"\u{11f0}\u{11f0}\u{11f9}\u{11f9}\u{1e00}\u{1e9b}\u{1ea0}\u{1ef9}" . |
|
128
|
|
|
"\u{1f00}\u{1f15}\u{1f18}\u{1f1d}\u{1f20}\u{1f45}\u{1f48}\u{1f4d}" . |
|
129
|
|
|
"\u{1f50}\u{1f57}\u{1f59}\u{1f59}\u{1f5b}\u{1f5b}\u{1f5d}\u{1f5d}" . |
|
130
|
|
|
"\u{1f5f}\u{1f7d}\u{1f80}\u{1fb4}\u{1fb6}\u{1fbc}\u{1fbe}\u{1fbe}" . |
|
131
|
|
|
"\u{1fc2}\u{1fc4}\u{1fc6}\u{1fcc}\u{1fd0}\u{1fd3}\u{1fd6}\u{1fdb}" . |
|
132
|
|
|
"\u{1fe0}\u{1fec}\u{1ff2}\u{1ff4}\u{1ff6}\u{1ffc}\u{2126}\u{2126}" . |
|
133
|
|
|
"\u{212a}\u{212b}\u{212e}\u{212e}\u{2180}\u{2182}\u{3007}\u{3007}" . |
|
134
|
|
|
"\u{3021}\u{3029}\u{3041}\u{3094}\u{30a1}\u{30fa}\u{3105}\u{312c}" . |
|
135
|
|
|
"\u{4e00}\u{9fa5}\u{ac00}\u{d7a3}"; |
|
136
|
|
|
protected const s_NCName = |
|
137
|
|
|
"\u{002d}\u{002e}\u{0030}\u{0039}\u{0041}\u{005a}\u{005f}\u{005f}" . |
|
138
|
|
|
"\u{0061}\u{007a}\u{00b7}\u{00b7}\u{00c0}\u{00d6}\u{00d8}\u{00f6}" . |
|
139
|
|
|
"\u{00f8}\u{0131}\u{0134}\u{013e}\u{0141}\u{0148}\u{014a}\u{017e}" . |
|
140
|
|
|
"\u{0180}\u{01c3}\u{01cd}\u{01f0}\u{01f4}\u{01f5}\u{01fa}\u{0217}" . |
|
141
|
|
|
"\u{0250}\u{02a8}\u{02bb}\u{02c1}\u{02d0}\u{02d1}\u{0300}\u{0345}" . |
|
142
|
|
|
"\u{0360}\u{0361}\u{0386}\u{038a}\u{038c}\u{038c}\u{038e}\u{03a1}" . |
|
143
|
|
|
"\u{03a3}\u{03ce}\u{03d0}\u{03d6}\u{03da}\u{03da}\u{03dc}\u{03dc}" . |
|
144
|
|
|
"\u{03de}\u{03de}\u{03e0}\u{03e0}\u{03e2}\u{03f3}\u{0401}\u{040c}" . |
|
145
|
|
|
"\u{040e}\u{044f}\u{0451}\u{045c}\u{045e}\u{0481}\u{0483}\u{0486}" . |
|
146
|
|
|
"\u{0490}\u{04c4}\u{04c7}\u{04c8}\u{04cb}\u{04cc}\u{04d0}\u{04eb}" . |
|
147
|
|
|
"\u{04ee}\u{04f5}\u{04f8}\u{04f9}\u{0531}\u{0556}\u{0559}\u{0559}" . |
|
148
|
|
|
"\u{0561}\u{0586}\u{0591}\u{05a1}\u{05a3}\u{05b9}\u{05bb}\u{05bd}" . |
|
149
|
|
|
"\u{05bf}\u{05bf}\u{05c1}\u{05c2}\u{05c4}\u{05c4}\u{05d0}\u{05ea}" . |
|
150
|
|
|
"\u{05f0}\u{05f2}\u{0621}\u{063a}\u{0640}\u{0652}\u{0660}\u{0669}" . |
|
151
|
|
|
"\u{0670}\u{06b7}\u{06ba}\u{06be}\u{06c0}\u{06ce}\u{06d0}\u{06d3}" . |
|
152
|
|
|
"\u{06d5}\u{06e8}\u{06ea}\u{06ed}\u{06f0}\u{06f9}\u{0901}\u{0903}" . |
|
153
|
|
|
"\u{0905}\u{0939}\u{093c}\u{094d}\u{0951}\u{0954}\u{0958}\u{0963}" . |
|
154
|
|
|
"\u{0966}\u{096f}\u{0981}\u{0983}\u{0985}\u{098c}\u{098f}\u{0990}" . |
|
155
|
|
|
"\u{0993}\u{09a8}\u{09aa}\u{09b0}\u{09b2}\u{09b2}\u{09b6}\u{09b9}" . |
|
156
|
|
|
"\u{09bc}\u{09bc}\u{09be}\u{09c4}\u{09c7}\u{09c8}\u{09cb}\u{09cd}" . |
|
157
|
|
|
"\u{09d7}\u{09d7}\u{09dc}\u{09dd}\u{09df}\u{09e3}\u{09e6}\u{09f1}" . |
|
158
|
|
|
"\u{0a02}\u{0a02}\u{0a05}\u{0a0a}\u{0a0f}\u{0a10}\u{0a13}\u{0a28}" . |
|
159
|
|
|
"\u{0a2a}\u{0a30}\u{0a32}\u{0a33}\u{0a35}\u{0a36}\u{0a38}\u{0a39}" . |
|
160
|
|
|
"\u{0a3c}\u{0a3c}\u{0a3e}\u{0a42}\u{0a47}\u{0a48}\u{0a4b}\u{0a4d}" . |
|
161
|
|
|
"\u{0a59}\u{0a5c}\u{0a5e}\u{0a5e}\u{0a66}\u{0a74}\u{0a81}\u{0a83}" . |
|
162
|
|
|
"\u{0a85}\u{0a8b}\u{0a8d}\u{0a8d}\u{0a8f}\u{0a91}\u{0a93}\u{0aa8}" . |
|
163
|
|
|
"\u{0aaa}\u{0ab0}\u{0ab2}\u{0ab3}\u{0ab5}\u{0ab9}\u{0abc}\u{0ac5}" . |
|
164
|
|
|
"\u{0ac7}\u{0ac9}\u{0acb}\u{0acd}\u{0ae0}\u{0ae0}\u{0ae6}\u{0aef}" . |
|
165
|
|
|
"\u{0b01}\u{0b03}\u{0b05}\u{0b0c}\u{0b0f}\u{0b10}\u{0b13}\u{0b28}" . |
|
166
|
|
|
"\u{0b2a}\u{0b30}\u{0b32}\u{0b33}\u{0b36}\u{0b39}\u{0b3c}\u{0b43}" . |
|
167
|
|
|
"\u{0b47}\u{0b48}\u{0b4b}\u{0b4d}\u{0b56}\u{0b57}\u{0b5c}\u{0b5d}" . |
|
168
|
|
|
"\u{0b5f}\u{0b61}\u{0b66}\u{0b6f}\u{0b82}\u{0b83}\u{0b85}\u{0b8a}" . |
|
169
|
|
|
"\u{0b8e}\u{0b90}\u{0b92}\u{0b95}\u{0b99}\u{0b9a}\u{0b9c}\u{0b9c}" . |
|
170
|
|
|
"\u{0b9e}\u{0b9f}\u{0ba3}\u{0ba4}\u{0ba8}\u{0baa}\u{0bae}\u{0bb5}" . |
|
171
|
|
|
"\u{0bb7}\u{0bb9}\u{0bbe}\u{0bc2}\u{0bc6}\u{0bc8}\u{0bca}\u{0bcd}" . |
|
172
|
|
|
"\u{0bd7}\u{0bd7}\u{0be7}\u{0bef}\u{0c01}\u{0c03}\u{0c05}\u{0c0c}" . |
|
173
|
|
|
"\u{0c0e}\u{0c10}\u{0c12}\u{0c28}\u{0c2a}\u{0c33}\u{0c35}\u{0c39}" . |
|
174
|
|
|
"\u{0c3e}\u{0c44}\u{0c46}\u{0c48}\u{0c4a}\u{0c4d}\u{0c55}\u{0c56}" . |
|
175
|
|
|
"\u{0c60}\u{0c61}\u{0c66}\u{0c6f}\u{0c82}\u{0c83}\u{0c85}\u{0c8c}" . |
|
176
|
|
|
"\u{0c8e}\u{0c90}\u{0c92}\u{0ca8}\u{0caa}\u{0cb3}\u{0cb5}\u{0cb9}" . |
|
177
|
|
|
"\u{0cbe}\u{0cc4}\u{0cc6}\u{0cc8}\u{0cca}\u{0ccd}\u{0cd5}\u{0cd6}" . |
|
178
|
|
|
"\u{0cde}\u{0cde}\u{0ce0}\u{0ce1}\u{0ce6}\u{0cef}\u{0d02}\u{0d03}" . |
|
179
|
|
|
"\u{0d05}\u{0d0c}\u{0d0e}\u{0d10}\u{0d12}\u{0d28}\u{0d2a}\u{0d39}" . |
|
180
|
|
|
"\u{0d3e}\u{0d43}\u{0d46}\u{0d48}\u{0d4a}\u{0d4d}\u{0d57}\u{0d57}" . |
|
181
|
|
|
"\u{0d60}\u{0d61}\u{0d66}\u{0d6f}\u{0e01}\u{0e2e}\u{0e30}\u{0e3a}" . |
|
182
|
|
|
"\u{0e40}\u{0e4e}\u{0e50}\u{0e59}\u{0e81}\u{0e82}\u{0e84}\u{0e84}" . |
|
183
|
|
|
"\u{0e87}\u{0e88}\u{0e8a}\u{0e8a}\u{0e8d}\u{0e8d}\u{0e94}\u{0e97}" . |
|
184
|
|
|
"\u{0e99}\u{0e9f}\u{0ea1}\u{0ea3}\u{0ea5}\u{0ea5}\u{0ea7}\u{0ea7}" . |
|
185
|
|
|
"\u{0eaa}\u{0eab}\u{0ead}\u{0eae}\u{0eb0}\u{0eb9}\u{0ebb}\u{0ebd}" . |
|
186
|
|
|
"\u{0ec0}\u{0ec4}\u{0ec6}\u{0ec6}\u{0ec8}\u{0ecd}\u{0ed0}\u{0ed9}" . |
|
187
|
|
|
"\u{0f18}\u{0f19}\u{0f20}\u{0f29}\u{0f35}\u{0f35}\u{0f37}\u{0f37}" . |
|
188
|
|
|
"\u{0f39}\u{0f39}\u{0f3e}\u{0f47}\u{0f49}\u{0f69}\u{0f71}\u{0f84}" . |
|
189
|
|
|
"\u{0f86}\u{0f8b}\u{0f90}\u{0f95}\u{0f97}\u{0f97}\u{0f99}\u{0fad}" . |
|
190
|
|
|
"\u{0fb1}\u{0fb7}\u{0fb9}\u{0fb9}\u{10a0}\u{10c5}\u{10d0}\u{10f6}" . |
|
191
|
|
|
"\u{1100}\u{1100}\u{1102}\u{1103}\u{1105}\u{1107}\u{1109}\u{1109}" . |
|
192
|
|
|
"\u{110b}\u{110c}\u{110e}\u{1112}\u{113c}\u{113c}\u{113e}\u{113e}" . |
|
193
|
|
|
"\u{1140}\u{1140}\u{114c}\u{114c}\u{114e}\u{114e}\u{1150}\u{1150}" . |
|
194
|
|
|
"\u{1154}\u{1155}\u{1159}\u{1159}\u{115f}\u{1161}\u{1163}\u{1163}" . |
|
195
|
|
|
"\u{1165}\u{1165}\u{1167}\u{1167}\u{1169}\u{1169}\u{116d}\u{116e}" . |
|
196
|
|
|
"\u{1172}\u{1173}\u{1175}\u{1175}\u{119e}\u{119e}\u{11a8}\u{11a8}" . |
|
197
|
|
|
"\u{11ab}\u{11ab}\u{11ae}\u{11af}\u{11b7}\u{11b8}\u{11ba}\u{11ba}" . |
|
198
|
|
|
"\u{11bc}\u{11c2}\u{11eb}\u{11eb}\u{11f0}\u{11f0}\u{11f9}\u{11f9}" . |
|
199
|
|
|
"\u{1e00}\u{1e9b}\u{1ea0}\u{1ef9}\u{1f00}\u{1f15}\u{1f18}\u{1f1d}" . |
|
200
|
|
|
"\u{1f20}\u{1f45}\u{1f48}\u{1f4d}\u{1f50}\u{1f57}\u{1f59}\u{1f59}" . |
|
201
|
|
|
"\u{1f5b}\u{1f5b}\u{1f5d}\u{1f5d}\u{1f5f}\u{1f7d}\u{1f80}\u{1fb4}" . |
|
202
|
|
|
"\u{1fb6}\u{1fbc}\u{1fbe}\u{1fbe}\u{1fc2}\u{1fc4}\u{1fc6}\u{1fcc}" . |
|
203
|
|
|
"\u{1fd0}\u{1fd3}\u{1fd6}\u{1fdb}\u{1fe0}\u{1fec}\u{1ff2}\u{1ff4}" . |
|
204
|
|
|
"\u{1ff6}\u{1ffc}\u{20d0}\u{20dc}\u{20e1}\u{20e1}\u{2126}\u{2126}" . |
|
205
|
|
|
"\u{212a}\u{212b}\u{212e}\u{212e}\u{2180}\u{2182}\u{3005}\u{3005}" . |
|
206
|
|
|
"\u{3007}\u{3007}\u{3021}\u{302f}\u{3031}\u{3035}\u{3041}\u{3094}" . |
|
207
|
|
|
"\u{3099}\u{309a}\u{309d}\u{309e}\u{30a1}\u{30fa}\u{30fc}\u{30fe}" . |
|
208
|
|
|
"\u{3105}\u{312c}\u{4e00}\u{9fa5}\u{ac00}\u{d7a3}"; |
|
209
|
|
|
protected const s_NCNameXml4e = |
|
210
|
|
|
"\u{002d}\u{002e}\u{0030}\u{0039}\u{0041}\u{005a}\u{005f}\u{005f}" . |
|
211
|
|
|
"\u{0061}\u{007a}\u{00b7}\u{00b7}\u{00c0}\u{00d6}\u{00d8}\u{00f6}" . |
|
212
|
|
|
"\u{00f8}\u{0131}\u{0134}\u{013e}\u{0141}\u{0148}\u{014a}\u{017e}" . |
|
213
|
|
|
"\u{0180}\u{01c3}\u{01cd}\u{01f0}\u{01f4}\u{01f5}\u{01fa}\u{0217}" . |
|
214
|
|
|
"\u{0250}\u{02a8}\u{02bb}\u{02c1}\u{02d0}\u{02d1}\u{0300}\u{0345}" . |
|
215
|
|
|
"\u{0360}\u{0361}\u{0386}\u{038a}\u{038c}\u{038c}\u{038e}\u{03a1}" . |
|
216
|
|
|
"\u{03a3}\u{03ce}\u{03d0}\u{03d6}\u{03da}\u{03da}\u{03dc}\u{03dc}" . |
|
217
|
|
|
"\u{03de}\u{03de}\u{03e0}\u{03e0}\u{03e2}\u{03f3}\u{0401}\u{040c}" . |
|
218
|
|
|
"\u{040e}\u{044f}\u{0451}\u{045c}\u{045e}\u{0481}\u{0483}\u{0486}" . |
|
219
|
|
|
"\u{0490}\u{04c4}\u{04c7}\u{04c8}\u{04cb}\u{04cc}\u{04d0}\u{04eb}" . |
|
220
|
|
|
"\u{04ee}\u{04f5}\u{04f8}\u{04f9}\u{0531}\u{0556}\u{0559}\u{0559}" . |
|
221
|
|
|
"\u{0561}\u{0586}\u{0591}\u{05a1}\u{05a3}\u{05b9}\u{05bb}\u{05bd}" . |
|
222
|
|
|
"\u{05bf}\u{05bf}\u{05c1}\u{05c2}\u{05c4}\u{05c4}\u{05d0}\u{05ea}" . |
|
223
|
|
|
"\u{05f0}\u{05f2}\u{0621}\u{063a}\u{0640}\u{0652}\u{0660}\u{0669}" . |
|
224
|
|
|
"\u{0670}\u{06b7}\u{06ba}\u{06be}\u{06c0}\u{06ce}\u{06d0}\u{06d3}" . |
|
225
|
|
|
"\u{06d5}\u{06e8}\u{06ea}\u{06ed}\u{06f0}\u{06f9}\u{0901}\u{0903}" . |
|
226
|
|
|
"\u{0905}\u{0939}\u{093c}\u{094d}\u{0951}\u{0954}\u{0958}\u{0963}" . |
|
227
|
|
|
"\u{0966}\u{096f}\u{0981}\u{0983}\u{0985}\u{098c}\u{098f}\u{0990}" . |
|
228
|
|
|
"\u{0993}\u{09a8}\u{09aa}\u{09b0}\u{09b2}\u{09b2}\u{09b6}\u{09b9}" . |
|
229
|
|
|
"\u{09bc}\u{09bc}\u{09be}\u{09c4}\u{09c7}\u{09c8}\u{09cb}\u{09cd}" . |
|
230
|
|
|
"\u{09d7}\u{09d7}\u{09dc}\u{09dd}\u{09df}\u{09e3}\u{09e6}\u{09f1}" . |
|
231
|
|
|
"\u{0a02}\u{0a02}\u{0a05}\u{0a0a}\u{0a0f}\u{0a10}\u{0a13}\u{0a28}" . |
|
232
|
|
|
"\u{0a2a}\u{0a30}\u{0a32}\u{0a33}\u{0a35}\u{0a36}\u{0a38}\u{0a39}" . |
|
233
|
|
|
"\u{0a3c}\u{0a3c}\u{0a3e}\u{0a42}\u{0a47}\u{0a48}\u{0a4b}\u{0a4d}" . |
|
234
|
|
|
"\u{0a59}\u{0a5c}\u{0a5e}\u{0a5e}\u{0a66}\u{0a74}\u{0a81}\u{0a83}" . |
|
235
|
|
|
"\u{0a85}\u{0a8b}\u{0a8d}\u{0a8d}\u{0a8f}\u{0a91}\u{0a93}\u{0aa8}" . |
|
236
|
|
|
"\u{0aaa}\u{0ab0}\u{0ab2}\u{0ab3}\u{0ab5}\u{0ab9}\u{0abc}\u{0ac5}" . |
|
237
|
|
|
"\u{0ac7}\u{0ac9}\u{0acb}\u{0acd}\u{0ae0}\u{0ae0}\u{0ae6}\u{0aef}" . |
|
238
|
|
|
"\u{0b01}\u{0b03}\u{0b05}\u{0b0c}\u{0b0f}\u{0b10}\u{0b13}\u{0b28}" . |
|
239
|
|
|
"\u{0b2a}\u{0b30}\u{0b32}\u{0b33}\u{0b36}\u{0b39}\u{0b3c}\u{0b43}" . |
|
240
|
|
|
"\u{0b47}\u{0b48}\u{0b4b}\u{0b4d}\u{0b56}\u{0b57}\u{0b5c}\u{0b5d}" . |
|
241
|
|
|
"\u{0b5f}\u{0b61}\u{0b66}\u{0b6f}\u{0b82}\u{0b83}\u{0b85}\u{0b8a}" . |
|
242
|
|
|
"\u{0b8e}\u{0b90}\u{0b92}\u{0b95}\u{0b99}\u{0b9a}\u{0b9c}\u{0b9c}" . |
|
243
|
|
|
"\u{0b9e}\u{0b9f}\u{0ba3}\u{0ba4}\u{0ba8}\u{0baa}\u{0bae}\u{0bb5}" . |
|
244
|
|
|
"\u{0bb7}\u{0bb9}\u{0bbe}\u{0bc2}\u{0bc6}\u{0bc8}\u{0bca}\u{0bcd}" . |
|
245
|
|
|
"\u{0bd7}\u{0bd7}\u{0be7}\u{0bef}\u{0c01}\u{0c03}\u{0c05}\u{0c0c}" . |
|
246
|
|
|
"\u{0c0e}\u{0c10}\u{0c12}\u{0c28}\u{0c2a}\u{0c33}\u{0c35}\u{0c39}" . |
|
247
|
|
|
"\u{0c3e}\u{0c44}\u{0c46}\u{0c48}\u{0c4a}\u{0c4d}\u{0c55}\u{0c56}" . |
|
248
|
|
|
"\u{0c60}\u{0c61}\u{0c66}\u{0c6f}\u{0c82}\u{0c83}\u{0c85}\u{0c8c}" . |
|
249
|
|
|
"\u{0c8e}\u{0c90}\u{0c92}\u{0ca8}\u{0caa}\u{0cb3}\u{0cb5}\u{0cb9}" . |
|
250
|
|
|
"\u{0cbe}\u{0cc4}\u{0cc6}\u{0cc8}\u{0cca}\u{0ccd}\u{0cd5}\u{0cd6}" . |
|
251
|
|
|
"\u{0cde}\u{0cde}\u{0ce0}\u{0ce1}\u{0ce6}\u{0cef}\u{0d02}\u{0d03}" . |
|
252
|
|
|
"\u{0d05}\u{0d0c}\u{0d0e}\u{0d10}\u{0d12}\u{0d28}\u{0d2a}\u{0d39}" . |
|
253
|
|
|
"\u{0d3e}\u{0d43}\u{0d46}\u{0d48}\u{0d4a}\u{0d4d}\u{0d57}\u{0d57}" . |
|
254
|
|
|
"\u{0d60}\u{0d61}\u{0d66}\u{0d6f}\u{0e01}\u{0e2e}\u{0e30}\u{0e3a}" . |
|
255
|
|
|
"\u{0e40}\u{0e4e}\u{0e50}\u{0e59}\u{0e81}\u{0e82}\u{0e84}\u{0e84}" . |
|
256
|
|
|
"\u{0e87}\u{0e88}\u{0e8a}\u{0e8a}\u{0e8d}\u{0e8d}\u{0e94}\u{0e97}" . |
|
257
|
|
|
"\u{0e99}\u{0e9f}\u{0ea1}\u{0ea3}\u{0ea5}\u{0ea5}\u{0ea7}\u{0ea7}" . |
|
258
|
|
|
"\u{0eaa}\u{0eab}\u{0ead}\u{0eae}\u{0eb0}\u{0eb9}\u{0ebb}\u{0ebd}" . |
|
259
|
|
|
"\u{0ec0}\u{0ec4}\u{0ec6}\u{0ec6}\u{0ec8}\u{0ecd}\u{0ed0}\u{0ed9}" . |
|
260
|
|
|
"\u{0f18}\u{0f19}\u{0f20}\u{0f29}\u{0f35}\u{0f35}\u{0f37}\u{0f37}" . |
|
261
|
|
|
"\u{0f39}\u{0f39}\u{0f3e}\u{0f47}\u{0f49}\u{0f69}\u{0f71}\u{0f84}" . |
|
262
|
|
|
"\u{0f86}\u{0f8b}\u{0f90}\u{0f95}\u{0f97}\u{0f97}\u{0f99}\u{0fad}" . |
|
263
|
|
|
"\u{0fb1}\u{0fb7}\u{0fb9}\u{0fb9}\u{10a0}\u{10c5}\u{10d0}\u{10f6}" . |
|
264
|
|
|
"\u{1100}\u{1100}\u{1102}\u{1103}\u{1105}\u{1107}\u{1109}\u{1109}" . |
|
265
|
|
|
"\u{110b}\u{110c}\u{110e}\u{1112}\u{113c}\u{113c}\u{113e}\u{113e}" . |
|
266
|
|
|
"\u{1140}\u{1140}\u{114c}\u{114c}\u{114e}\u{114e}\u{1150}\u{1150}" . |
|
267
|
|
|
"\u{1154}\u{1155}\u{1159}\u{1159}\u{115f}\u{1161}\u{1163}\u{1163}" . |
|
268
|
|
|
"\u{1165}\u{1165}\u{1167}\u{1167}\u{1169}\u{1169}\u{116d}\u{116e}" . |
|
269
|
|
|
"\u{1172}\u{1173}\u{1175}\u{1175}\u{119e}\u{119e}\u{11a8}\u{11a8}" . |
|
270
|
|
|
"\u{11ab}\u{11ab}\u{11ae}\u{11af}\u{11b7}\u{11b8}\u{11ba}\u{11ba}" . |
|
271
|
|
|
"\u{11bc}\u{11c2}\u{11eb}\u{11eb}\u{11f0}\u{11f0}\u{11f9}\u{11f9}" . |
|
272
|
|
|
"\u{1e00}\u{1e9b}\u{1ea0}\u{1ef9}\u{1f00}\u{1f15}\u{1f18}\u{1f1d}" . |
|
273
|
|
|
"\u{1f20}\u{1f45}\u{1f48}\u{1f4d}\u{1f50}\u{1f57}\u{1f59}\u{1f59}" . |
|
274
|
|
|
"\u{1f5b}\u{1f5b}\u{1f5d}\u{1f5d}\u{1f5f}\u{1f7d}\u{1f80}\u{1fb4}" . |
|
275
|
|
|
"\u{1fb6}\u{1fbc}\u{1fbe}\u{1fbe}\u{1fc2}\u{1fc4}\u{1fc6}\u{1fcc}" . |
|
276
|
|
|
"\u{1fd0}\u{1fd3}\u{1fd6}\u{1fdb}\u{1fe0}\u{1fec}\u{1ff2}\u{1ff4}" . |
|
277
|
|
|
"\u{1ff6}\u{1ffc}\u{20d0}\u{20dc}\u{20e1}\u{20e1}\u{2126}\u{2126}" . |
|
278
|
|
|
"\u{212a}\u{212b}\u{212e}\u{212e}\u{2180}\u{2182}\u{3005}\u{3005}" . |
|
279
|
|
|
"\u{3007}\u{3007}\u{3021}\u{302f}\u{3031}\u{3035}\u{3041}\u{3094}" . |
|
280
|
|
|
"\u{3099}\u{309a}\u{309d}\u{309e}\u{30a1}\u{30fa}\u{30fc}\u{30fe}" . |
|
281
|
|
|
"\u{3105}\u{312c}\u{4e00}\u{9fa5}\u{ac00}\u{d7a3}"; |
|
282
|
|
|
|
|
283
|
|
|
protected const s_CharData = |
|
284
|
|
|
"\u{0009}\u{000a}\u{000d}\u{000d}\u{0020}\u{d7ff}\u{e000}\u{fffd}"; |
|
285
|
|
|
|
|
286
|
|
|
|
|
287
|
|
|
protected const s_Text = // TextChar = CharData - { 0xA | 0xD | '<' | '&' | 0x9 | ']' | 0xDC00 - 0xDFFF } |
|
288
|
|
|
"\u{0020}\u{0025}\u{0027}\u{003b}\u{003d}\u{005c}\u{005e}\u{d7ff}\u{e000}\u{fffd}"; |
|
289
|
|
|
|
|
290
|
|
|
|
|
291
|
|
|
protected const s_AttrValue = // AttrValueChar = CharData - { 0xA | 0xD | 0x9 | '<' | '>' | '&' | '\'' | '"' | 0xDC00 - 0xDFFF } |
|
292
|
|
|
"\u{0020}\u{0021}\u{0023}\u{0025}\u{0028}\u{003b}\u{003d}\u{003d}\u{003f}\u{d7ff}\u{e000}\u{fffd}"; |
|
293
|
|
|
#endregion |
|
294
|
|
|
|
|
295
|
|
|
#region "Static" |
|
296
|
|
|
/** |
|
297
|
|
|
* @var int[] |
|
298
|
|
|
*/ |
|
299
|
|
|
protected static $s_CharProperties = null; |
|
300
|
|
|
|
|
301
|
|
|
/** |
|
302
|
|
|
* @var resource|null |
|
303
|
|
|
*/ |
|
304
|
|
|
protected static $m_CharProperties = null; |
|
305
|
|
|
|
|
306
|
|
|
public static function initInstance(): void |
|
307
|
|
|
{ |
|
308
|
|
|
if (self::$m_CharProperties != null) { |
|
309
|
|
|
return; |
|
310
|
|
|
} |
|
311
|
|
|
if (file_exists('XmlCharType.bin')) { |
|
312
|
|
|
$loaded = false; |
|
313
|
|
|
$file = fopen('XmlCharType.bin', 'rb'); |
|
314
|
|
|
if (is_resource($file)) { |
|
315
|
|
|
self::$m_CharProperties = fopen('php://memory', 'w+b'); |
|
|
|
|
|
|
316
|
|
|
if (is_resource(self::$m_CharProperties)) { |
|
317
|
|
|
stream_copy_to_stream($file, self::$m_CharProperties); |
|
318
|
|
|
$loaded = true; |
|
319
|
|
|
} |
|
320
|
|
|
fclose($file); |
|
321
|
|
|
if ($loaded) { |
|
322
|
|
|
return; |
|
323
|
|
|
} |
|
324
|
|
|
} |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
$chProps = []; |
|
328
|
|
|
self::$s_CharProperties = $chProps; |
|
329
|
|
|
self::setProperties(self::s_Whitespace, self::fWhitespace); |
|
330
|
|
|
self::setProperties(self::s_LetterXml4e, self::fLetter); |
|
331
|
|
|
self::setProperties(self::s_NCStartName, self::fNCStartNameSC); |
|
332
|
|
|
self::setProperties(self::s_NCName, self::fNCNameSC); |
|
333
|
|
|
self::setProperties(self::s_CharData, self::fCharData); |
|
334
|
|
|
self::setProperties(self::s_NCNameXml4e, self::fNCNameXml4e); |
|
335
|
|
|
self::setProperties(self::s_Text, self::fText); |
|
336
|
|
|
self::setProperties(self::s_AttrValue, self::fAttrValue); |
|
337
|
|
|
self::generateFile(); |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
private static function setProperties(string $ranges, int $value): void |
|
341
|
|
|
{ |
|
342
|
|
|
assert(mb_strlen($ranges, 'UTF-8') % 2 === 0); |
|
343
|
|
|
for ($p = 0; $p < mb_strlen($ranges, 'UTF-8'); $p +=2) { |
|
344
|
|
|
$str1 = mb_substr($ranges, $p, 1, 'UTF-8'); |
|
345
|
|
|
$str2 = mb_substr($ranges, $p+1, 1, 'UTF-8'); |
|
346
|
|
|
for ($i = mb_ord($str1), |
|
|
|
|
|
|
347
|
|
|
$last = mb_ord($str2); $i <= $last; $i++) { |
|
348
|
|
|
if (!isset(self::$s_CharProperties[$i])) { |
|
349
|
|
|
self::$s_CharProperties[$i] = $value; |
|
350
|
|
|
} |
|
351
|
|
|
self::$s_CharProperties[$i] |= $value; |
|
352
|
|
|
} |
|
353
|
|
|
} |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
protected static function generateFile(): void |
|
357
|
|
|
{ |
|
358
|
|
|
$fileArray = []; |
|
359
|
|
|
for ($i = 0; $i < 65536; $i++) { |
|
360
|
|
|
$fileArray[$i] = XmlCharType::$s_CharProperties[$i] ?? 0; |
|
361
|
|
|
} |
|
362
|
|
|
$bin = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'XmlCharType.bin', 'w+b'); |
|
363
|
|
|
self::$m_CharProperties = fopen('php://memory', 'w+b'); |
|
|
|
|
|
|
364
|
|
|
foreach ($fileArray as $enum) { |
|
365
|
|
|
fwrite($bin, chr($enum)); |
|
|
|
|
|
|
366
|
|
|
fwrite(self::$m_CharProperties, chr($enum)); |
|
367
|
|
|
} |
|
368
|
|
|
fclose($bin); |
|
|
|
|
|
|
369
|
|
|
} |
|
370
|
|
|
#endregion |
|
371
|
|
|
|
|
372
|
|
|
/** |
|
373
|
|
|
* @var XmlCharType|null |
|
374
|
|
|
*/ |
|
375
|
|
|
private static $instance = null; |
|
376
|
|
|
|
|
377
|
|
|
public static function instance(): XmlCharType |
|
378
|
|
|
{ |
|
379
|
|
|
self::initInstance(); |
|
380
|
|
|
$umArray = new UnmanagedByteArray(self::$m_CharProperties); |
|
381
|
|
|
return self::$instance ?? self::$instance = new self($umArray); |
|
382
|
|
|
} |
|
383
|
|
|
|
|
384
|
|
|
/** |
|
385
|
|
|
* @var array<mixed>|\ArrayAccess<mixed,mixed>|null |
|
386
|
|
|
*/ |
|
387
|
|
|
private $charProperties = null; |
|
388
|
|
|
|
|
389
|
|
|
/** |
|
390
|
|
|
* XmlCharType constructor. |
|
391
|
|
|
* @param array<mixed>|\ArrayAccess<mixed,mixed>|mixed $charProperties |
|
392
|
|
|
*/ |
|
393
|
|
|
public function __construct(&$charProperties) |
|
394
|
|
|
{ |
|
395
|
|
|
assert(is_array($charProperties) || $charProperties instanceof \ArrayAccess); |
|
396
|
|
|
$this->charProperties = $charProperties; |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
public function isStartNCNameChar(string $ch): bool |
|
400
|
|
|
{ |
|
401
|
|
|
assert(mb_strlen($ch, 'UTF-8') === 1); |
|
402
|
|
|
return ($this->charProperties[mb_ord($ch, 'UTF-8')] & self::fNCStartNameSC) !== 0; |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
public function isNCNameChar(string $ch): bool |
|
406
|
|
|
{ |
|
407
|
|
|
return ($this->charProperties[mb_ord($ch, 'UTF-8')] & self::fNCNameSC) !== 0; |
|
408
|
|
|
} |
|
409
|
|
|
} |
|
410
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.