← All changes
|
vendor/masterminds/html5/src/HTML5/Parser/Scanner.php
+18
-18
3.0.15
→
3.2.90
View file →
| @@ -37,9 +37,9 @@ | ||
| 37 | 37 | */ |
| 38 | 38 | public function __construct($data, $encoding = 'UTF-8') |
| 39 | 39 | { |
| 40 | 40 | if ($data instanceof InputStream) { |
| 41 | - @\trigger_error('InputStream objects are deprecated since version 2.4 and will be removed in 3.0. Use strings instead.', \E_USER_DEPRECATED); | |
| 41 | + @trigger_error('InputStream objects are deprecated since version 2.4 and will be removed in 3.0. Use strings instead.', \E_USER_DEPRECATED); | |
| 42 | 42 | $data = (string) $data; |
| 43 | 43 | } |
| 44 | 44 | $data = UTF8Utils::convertToUTF8($data, $encoding); |
| 45 | 45 | // There is good reason to question whether it makes sense to |
| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | $this->errors = UTF8Utils::checkForIllegalCodepoints($data); |
| 49 | 49 | $data = $this->replaceLinefeeds($data); |
| 50 | 50 | $this->data = $data; |
| 51 | 51 | $this->char = 0; |
| 52 | - $this->EOF = \strlen($data); | |
| 52 | + $this->EOF = strlen($data); | |
| 53 | 53 | } |
| 54 | 54 | /** |
| 55 | 55 | * Check if upcomming chars match the given sequence. |
| 56 | 56 | * |
| @@ -70,10 +70,10 @@ | ||
| 70 | 70 | * @return bool |
| 71 | 71 | */ |
| 72 | 72 | public function sequenceMatches($sequence, $caseSensitive = \true) |
| 73 | 73 | { |
| 74 | - $portion = \substr($this->data, $this->char, \strlen($sequence)); | |
| 75 | - return $caseSensitive ? $portion === $sequence : 0 === \strcasecmp($portion, $sequence); | |
| 74 | + $portion = substr($this->data, $this->char, strlen($sequence)); | |
| 75 | + return $caseSensitive ? $portion === $sequence : 0 === strcasecmp($portion, $sequence); | |
| 76 | 76 | } |
| 77 | 77 | /** |
| 78 | 78 | * Get the current position. |
| 79 | 79 | * |
| @@ -197,9 +197,9 @@ | ||
| 197 | 197 | { |
| 198 | 198 | if ($this->char >= $this->EOF) { |
| 199 | 199 | return \false; |
| 200 | 200 | } |
| 201 | - $len = \strspn($this->data, "\n\t\f ", $this->char); | |
| 201 | + $len = strspn($this->data, "\n\t\f ", $this->char); | |
| 202 | 202 | $this->char += $len; |
| 203 | 203 | return $len; |
| 204 | 204 | } |
| 205 | 205 | /** |
| @@ -213,9 +213,9 @@ | ||
| 213 | 213 | return 1; |
| 214 | 214 | } |
| 215 | 215 | // Add one to $this->char because we want the number for the next |
| 216 | 216 | // byte to be processed. |
| 217 | - return \substr_count($this->data, "\n", 0, \min($this->char, $this->EOF)) + 1; | |
| 217 | + return substr_count($this->data, "\n", 0, min($this->char, $this->EOF)) + 1; | |
| 218 | 218 | } |
| 219 | 219 | /** |
| 220 | 220 | * Read chars until something in the mask is encountered. |
| 221 | 221 | * |
| @@ -255,17 +255,17 @@ | ||
| 255 | 255 | // want (i.e., the last \n before $this->char). This needs to not have |
| 256 | 256 | // one (to make it point to the next character, the one we want the |
| 257 | 257 | // position of) added to it because strrpos's behaviour includes the |
| 258 | 258 | // final offset byte. |
| 259 | - $backwardFrom = $this->char - 1 - \strlen($this->data); | |
| 260 | - $lastLine = \strrpos($this->data, "\n", $backwardFrom); | |
| 259 | + $backwardFrom = $this->char - 1 - strlen($this->data); | |
| 260 | + $lastLine = strrpos($this->data, "\n", $backwardFrom); | |
| 261 | 261 | // However, for here we want the length up until the next byte to be |
| 262 | 262 | // processed, so add one to the current byte ($this->char). |
| 263 | 263 | if (\false !== $lastLine) { |
| 264 | - $findLengthOf = \substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine); | |
| 264 | + $findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine); | |
| 265 | 265 | } else { |
| 266 | 266 | // After a newline. |
| 267 | - $findLengthOf = \substr($this->data, 0, $this->char); | |
| 267 | + $findLengthOf = substr($this->data, 0, $this->char); | |
| 268 | 268 | } |
| 269 | 269 | return UTF8Utils::countChars($findLengthOf); |
| 270 | 270 | } |
| 271 | 271 | /** |
| @@ -277,9 +277,9 @@ | ||
| 277 | 277 | */ |
| 278 | 278 | public function remainingChars() |
| 279 | 279 | { |
| 280 | 280 | if ($this->char < $this->EOF) { |
| 281 | - $data = \substr($this->data, $this->char); | |
| 281 | + $data = substr($this->data, $this->char); | |
| 282 | 282 | $this->char = $this->EOF; |
| 283 | 283 | return $data; |
| 284 | 284 | } |
| 285 | 285 | return ''; |
| @@ -301,9 +301,9 @@ | ||
| 301 | 301 | * represented by LF characters, and there are never any CR characters in the input to the tokenization |
| 302 | 302 | * stage. |
| 303 | 303 | */ |
| 304 | 304 | $crlfTable = array("\x00" => "�", "\r\n" => "\n", "\r" => "\n"); |
| 305 | - return \strtr($data, $crlfTable); | |
| 305 | + return strtr($data, $crlfTable); | |
| 306 | 306 | } |
| 307 | 307 | /** |
| 308 | 308 | * Read to a particular match (or until $max bytes are consumed). |
| 309 | 309 | * |
| @@ -323,13 +323,13 @@ | ||
| 323 | 323 | if ($this->char >= $this->EOF) { |
| 324 | 324 | return \false; |
| 325 | 325 | } |
| 326 | 326 | if (0 === $max || $max) { |
| 327 | - $len = \strcspn($this->data, $bytes, $this->char, $max); | |
| 327 | + $len = strcspn($this->data, $bytes, $this->char, $max); | |
| 328 | 328 | } else { |
| 329 | - $len = \strcspn($this->data, $bytes, $this->char); | |
| 329 | + $len = strcspn($this->data, $bytes, $this->char); | |
| 330 | 330 | } |
| 331 | - $string = (string) \substr($this->data, $this->char, $len); | |
| 331 | + $string = (string) substr($this->data, $this->char, $len); | |
| 332 | 332 | $this->char += $len; |
| 333 | 333 | return $string; |
| 334 | 334 | } |
| 335 | 335 | /** |
| @@ -350,13 +350,13 @@ | ||
| 350 | 350 | if ($this->char >= $this->EOF) { |
| 351 | 351 | return \false; |
| 352 | 352 | } |
| 353 | 353 | if (0 === $max || $max) { |
| 354 | - $len = \strspn($this->data, $bytes, $this->char, $max); | |
| 354 | + $len = strspn($this->data, $bytes, $this->char, $max); | |
| 355 | 355 | } else { |
| 356 | - $len = \strspn($this->data, $bytes, $this->char); | |
| 356 | + $len = strspn($this->data, $bytes, $this->char); | |
| 357 | 357 | } |
| 358 | - $string = (string) \substr($this->data, $this->char, $len); | |
| 358 | + $string = (string) substr($this->data, $this->char, $len); | |
| 359 | 359 | $this->char += $len; |
| 360 | 360 | return $string; |
| 361 | 361 | } |
| 362 | 362 | } |