| @@ 354-373 (lines=20) @@ | ||
| 351 | * |
|
| 352 | * @return string The remaining HTML. |
|
| 353 | */ |
|
| 354 | private function parseNoContents(string $tag, string $html) : string |
|
| 355 | { |
|
| 356 | $remainingHtml = ltrim($html); |
|
| 357 | $matchingResult = preg_match( |
|
| 358 | "/(<\/\s*" . $tag . "\s*>)/i", |
|
| 359 | $html, |
|
| 360 | $endOfScriptMatches |
|
| 361 | ); |
|
| 362 | if ($matchingResult === 0) { |
|
| 363 | return ''; |
|
| 364 | } |
|
| 365 | ||
| 366 | $closingTag = $endOfScriptMatches[1]; |
|
| 367 | $this->value = mb_substr($remainingHtml, 0, mb_strpos($html, $closingTag)); |
|
| 368 | ||
| 369 | return mb_substr( |
|
| 370 | mb_strstr($remainingHtml, $closingTag), |
|
| 371 | mb_strlen($closingTag) |
|
| 372 | ); |
|
| 373 | } |
|
| 374 | ||
| 375 | /** |
|
| 376 | * Getter for 'attributes'. |
|
| @@ 535-557 (lines=23) @@ | ||
| 532 | return $remainingHtml[0] === "'" || $remainingHtml[0] === '"'; |
|
| 533 | } |
|
| 534 | ||
| 535 | private function determineRemainingHtmlOfForeignContents(string $tag, string $html, string $remainingHtml) : string |
|
| 536 | { |
|
| 537 | $matchingResult = preg_match( |
|
| 538 | "/(<\/\s*" . $tag . "\s*>)/i", |
|
| 539 | $html, |
|
| 540 | $endOfScriptMatches |
|
| 541 | ); |
|
| 542 | if ($matchingResult === 0) { |
|
| 543 | $this->value = trim($remainingHtml); |
|
| 544 | ||
| 545 | return ''; |
|
| 546 | } |
|
| 547 | ||
| 548 | $closingTag = $endOfScriptMatches[1]; |
|
| 549 | $this->value = trim( |
|
| 550 | mb_substr($remainingHtml, 0, mb_strpos($remainingHtml, $closingTag)) |
|
| 551 | ); |
|
| 552 | ||
| 553 | return mb_substr( |
|
| 554 | mb_strstr($remainingHtml, $closingTag), |
|
| 555 | mb_strlen($closingTag) |
|
| 556 | ); |
|
| 557 | } |
|
| 558 | } |
|
| 559 | ||