@@ -111,6 +111,7 @@ public function __construct($url = null)
111
111
if ($ this ->unaChecked !== false ) {
112
112
$ this ->resetUNA ();
113
113
}
114
+
114
115
if ($ this ->unbChecked !== false ) {
115
116
$ this ->resetUNB ();
116
117
}
@@ -122,25 +123,25 @@ public function __construct($url = null)
122
123
return ;
123
124
}
124
125
if (\is_array ($ url )) {
125
- /**
126
- * Object constructed with an array as argument
127
- * /
126
+ //
127
+ // Object constructed with an array as argument
128
+ / /
128
129
if (\count ($ url ) == 1 ) {
129
130
$ url = $ this ->unwrap ($ url [0 ]);
130
131
}
131
132
$ this ->rawSegments = $ url ;
132
133
/** @noinspection UnusedFunctionResultInspection */
133
134
$ this ->parse ($ url );
134
135
} elseif (file_exists ($ url )) {
135
- /**
136
- * Object constructed with a path to a file as argument
137
- * /
136
+ //
137
+ // Object constructed with a path to a file as argument
138
+ / /
138
139
/** @noinspection UnusedFunctionResultInspection */
139
140
$ this ->load ($ url );
140
141
} else {
141
- /**
142
- * Object constructed with a string as argument
143
- * /
142
+ //
143
+ // Object constructed with a string as argument
144
+ / /
144
145
/** @noinspection UnusedFunctionResultInspection */
145
146
$ this ->loadString ($ url );
146
147
}
@@ -159,17 +160,13 @@ public function parse(&$file2): array
159
160
for ($ i = 1 ; $ i <= $ t ; $ i ++) {
160
161
$ line = \array_shift ($ file2 );
161
162
162
- /**
163
- * Null byte and carriage return removal (CR+LF)
164
- */
163
+ // Null byte and carriage return removal (CR+LF)
165
164
$ line = \preg_replace ('#[\x00\r\n]# ' , '' , $ line );
166
165
if (\preg_match ($ this ->stripChars , $ line )) {
167
166
$ this ->errors [] = "There's a not printable character on line " . $ i . ": " . $ line ;
168
167
}
169
168
170
- /**
171
- * Basic sanitization, remove non printable chars
172
- */
169
+ // Basic sanitization, remove non printable chars
173
170
$ line = \preg_replace ($ this ->stripChars , '' , \trim ($ line ));
174
171
if (\strlen ($ line ) < 2 ) {
175
172
continue ;
@@ -316,11 +313,12 @@ public function analyseUNH($line)
316
313
*
317
314
* @return string[]
318
315
*/
319
- private function unwrap ($ string ): array
316
+ private function unwrap (& $ string ): array
320
317
{
321
318
if (!$ this ->unaChecked && \strpos ($ string , "UNA " ) === 0 ) {
322
319
$ this ->analyseUNA (\preg_replace ("#^UNA# " , "" , substr ($ string , 0 , 9 )));
323
320
}
321
+
324
322
if (!$ this ->unbChecked && \strpos ($ string , "UNB " ) === 0 ) {
325
323
$ this ->analyseUNB (\preg_replace ("#^UNB\+# " , "" , substr ($ string , 0 , 8 )));
326
324
}
@@ -350,7 +348,7 @@ private function unwrap($string): array
350
348
*
351
349
* @return array[]|string[]
352
350
*/
353
- private function splitSegment ($ str ): array
351
+ private function splitSegment (& $ str ): array
354
352
{
355
353
// remove ending symbEnd
356
354
$ str = \trim (
@@ -405,7 +403,7 @@ private function splitSegment($str): array
405
403
*
406
404
* @return mixed
407
405
*/
408
- private function splitData($ str)
406
+ private function splitData(& $ str )
409
407
{
410
408
$ replace = function ($ string ) {
411
409
$ regex = self ::$ DELIMITER . $ this ->symbRel . "(?= " . $ this ->symbRel . ")| " . $ this ->symbRel . "(?= " . $ this ->sepData . ")| " . $ this ->symbRel . "(?= " . $ this ->sepComp . ")| " . $ this ->symbRel . "(?= " . $ this ->symbEnd . ") " . self ::$ DELIMITER ;
0 commit comments