@@ -450,7 +450,6 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
| 453 | - * @param bool $doMakeSameDomainLinksRelative |
|
| 454 | 453 | * |
| 455 | 454 | * @return $this |
| 456 | 455 | */ |
@@ -1315,7 +1314,7 @@ discard block |
||
| 1315 | 1314 | /** |
| 1316 | 1315 | * @param \DOMNode $node |
| 1317 | 1316 | * |
| 1318 | - * @return \DOMNode|null |
|
| 1317 | + * @return null|\DOMElement |
|
| 1319 | 1318 | */ |
| 1320 | 1319 | protected function getNextSiblingOfTypeDOMElement(\DOMNode $node) |
| 1321 | 1320 | { |
@@ -456,9 +456,9 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | public function doMakeSameDomainLinksRelative(string $localDomain = ''): self |
| 458 | 458 | { |
| 459 | - $this->localDomain = \rtrim((string) \preg_replace('/(?:https?:)?\/\//i', '', $localDomain), '/'); |
|
| 459 | + $this->localDomain = \rtrim((string) \preg_replace('/(?:https?:)?\/\//i', '', $localDomain), '/'); |
|
| 460 | 460 | |
| 461 | - $this->doMakeSameDomainLinksRelative = ($this->localDomain !== ''); |
|
| 461 | + $this->doMakeSameDomainLinksRelative = ($this->localDomain !== ''); |
|
| 462 | 462 | |
| 463 | 463 | return $this; |
| 464 | 464 | } |
@@ -689,206 +689,206 @@ discard block |
||
| 689 | 689 | return \in_array($tag_name, self::$optional_end_tags, true) |
| 690 | 690 | || |
| 691 | 691 | ( |
| 692 | - $tag_name === 'li' |
|
| 692 | + $tag_name === 'li' |
|
| 693 | 693 | && |
| 694 | 694 | ( |
| 695 | - $nextSibling === null |
|
| 695 | + $nextSibling === null |
|
| 696 | 696 | || |
| 697 | 697 | ( |
| 698 | - $nextSibling instanceof \DOMElement |
|
| 698 | + $nextSibling instanceof \DOMElement |
|
| 699 | 699 | && |
| 700 | 700 | $nextSibling->tagName === 'li' |
| 701 | - ) |
|
| 702 | - ) |
|
| 703 | - ) |
|
| 701 | + ) |
|
| 702 | + ) |
|
| 703 | + ) |
|
| 704 | 704 | || |
| 705 | 705 | ( |
| 706 | - $tag_name === 'rp' |
|
| 706 | + $tag_name === 'rp' |
|
| 707 | 707 | && |
| 708 | 708 | ( |
| 709 | - $nextSibling === null |
|
| 709 | + $nextSibling === null |
|
| 710 | 710 | || |
| 711 | 711 | ( |
| 712 | - $nextSibling instanceof \DOMElement |
|
| 712 | + $nextSibling instanceof \DOMElement |
|
| 713 | 713 | && |
| 714 | 714 | ( |
| 715 | - $nextSibling->tagName === 'rp' |
|
| 715 | + $nextSibling->tagName === 'rp' |
|
| 716 | 716 | || |
| 717 | 717 | $nextSibling->tagName === 'rt' |
| 718 | - ) |
|
| 719 | - ) |
|
| 720 | - ) |
|
| 721 | - ) |
|
| 718 | + ) |
|
| 719 | + ) |
|
| 720 | + ) |
|
| 721 | + ) |
|
| 722 | 722 | || |
| 723 | 723 | ( |
| 724 | - $tag_name === 'tr' |
|
| 724 | + $tag_name === 'tr' |
|
| 725 | 725 | && |
| 726 | 726 | ( |
| 727 | - $nextSibling === null |
|
| 727 | + $nextSibling === null |
|
| 728 | 728 | || |
| 729 | 729 | ( |
| 730 | - $nextSibling instanceof \DOMElement |
|
| 730 | + $nextSibling instanceof \DOMElement |
|
| 731 | 731 | && |
| 732 | 732 | $nextSibling->tagName === 'tr' |
| 733 | - ) |
|
| 734 | - ) |
|
| 735 | - ) |
|
| 733 | + ) |
|
| 734 | + ) |
|
| 735 | + ) |
|
| 736 | 736 | || |
| 737 | 737 | ( |
| 738 | - $tag_name === 'source' |
|
| 738 | + $tag_name === 'source' |
|
| 739 | 739 | && |
| 740 | 740 | ( |
| 741 | - $parent_tag_name === 'audio' |
|
| 741 | + $parent_tag_name === 'audio' |
|
| 742 | 742 | || |
| 743 | 743 | $parent_tag_name === 'video' |
| 744 | 744 | || |
| 745 | 745 | $parent_tag_name === 'picture' |
| 746 | 746 | || |
| 747 | 747 | $parent_tag_name === 'source' |
| 748 | - ) |
|
| 748 | + ) |
|
| 749 | 749 | && |
| 750 | 750 | ( |
| 751 | - $nextSibling === null |
|
| 751 | + $nextSibling === null |
|
| 752 | 752 | || |
| 753 | 753 | ( |
| 754 | - $nextSibling instanceof \DOMElement |
|
| 754 | + $nextSibling instanceof \DOMElement |
|
| 755 | 755 | && |
| 756 | 756 | $nextSibling->tagName === 'source' |
| 757 | - ) |
|
| 758 | - ) |
|
| 759 | - ) |
|
| 757 | + ) |
|
| 758 | + ) |
|
| 759 | + ) |
|
| 760 | 760 | || |
| 761 | 761 | ( |
| 762 | - ( |
|
| 763 | - $tag_name === 'td' |
|
| 762 | + ( |
|
| 763 | + $tag_name === 'td' |
|
| 764 | 764 | || |
| 765 | 765 | $tag_name === 'th' |
| 766 | - ) |
|
| 766 | + ) |
|
| 767 | 767 | && |
| 768 | 768 | ( |
| 769 | - $nextSibling === null |
|
| 769 | + $nextSibling === null |
|
| 770 | 770 | || |
| 771 | 771 | ( |
| 772 | - $nextSibling instanceof \DOMElement |
|
| 772 | + $nextSibling instanceof \DOMElement |
|
| 773 | 773 | && |
| 774 | 774 | ( |
| 775 | - $nextSibling->tagName === 'td' |
|
| 775 | + $nextSibling->tagName === 'td' |
|
| 776 | 776 | || |
| 777 | 777 | $nextSibling->tagName === 'th' |
| 778 | - ) |
|
| 779 | - ) |
|
| 780 | - ) |
|
| 781 | - ) |
|
| 778 | + ) |
|
| 779 | + ) |
|
| 780 | + ) |
|
| 781 | + ) |
|
| 782 | 782 | || |
| 783 | 783 | ( |
| 784 | - ( |
|
| 785 | - $tag_name === 'dd' |
|
| 784 | + ( |
|
| 785 | + $tag_name === 'dd' |
|
| 786 | 786 | || |
| 787 | 787 | $tag_name === 'dt' |
| 788 | - ) |
|
| 788 | + ) |
|
| 789 | 789 | && |
| 790 | 790 | ( |
| 791 | - ( |
|
| 792 | - $nextSibling === null |
|
| 791 | + ( |
|
| 792 | + $nextSibling === null |
|
| 793 | 793 | && |
| 794 | 794 | $tag_name === 'dd' |
| 795 | - ) |
|
| 795 | + ) |
|
| 796 | 796 | || |
| 797 | 797 | ( |
| 798 | - $nextSibling instanceof \DOMElement |
|
| 798 | + $nextSibling instanceof \DOMElement |
|
| 799 | 799 | && |
| 800 | 800 | ( |
| 801 | - $nextSibling->tagName === 'dd' |
|
| 801 | + $nextSibling->tagName === 'dd' |
|
| 802 | 802 | || |
| 803 | 803 | $nextSibling->tagName === 'dt' |
| 804 | - ) |
|
| 805 | - ) |
|
| 806 | - ) |
|
| 807 | - ) |
|
| 804 | + ) |
|
| 805 | + ) |
|
| 806 | + ) |
|
| 807 | + ) |
|
| 808 | 808 | || |
| 809 | 809 | ( |
| 810 | - $tag_name === 'option' |
|
| 810 | + $tag_name === 'option' |
|
| 811 | 811 | && |
| 812 | 812 | ( |
| 813 | - $nextSibling === null |
|
| 813 | + $nextSibling === null |
|
| 814 | 814 | || |
| 815 | 815 | ( |
| 816 | - $nextSibling instanceof \DOMElement |
|
| 816 | + $nextSibling instanceof \DOMElement |
|
| 817 | 817 | && |
| 818 | 818 | ( |
| 819 | - $nextSibling->tagName === 'option' |
|
| 819 | + $nextSibling->tagName === 'option' |
|
| 820 | 820 | || |
| 821 | 821 | $nextSibling->tagName === 'optgroup' |
| 822 | - ) |
|
| 823 | - ) |
|
| 824 | - ) |
|
| 825 | - ) |
|
| 822 | + ) |
|
| 823 | + ) |
|
| 824 | + ) |
|
| 825 | + ) |
|
| 826 | 826 | || |
| 827 | 827 | ( |
| 828 | - $tag_name === 'p' |
|
| 828 | + $tag_name === 'p' |
|
| 829 | 829 | && |
| 830 | 830 | ( |
| 831 | - ( |
|
| 832 | - $nextSibling === null |
|
| 831 | + ( |
|
| 832 | + $nextSibling === null |
|
| 833 | 833 | && |
| 834 | 834 | ( |
| 835 | - $node->parentNode !== null |
|
| 835 | + $node->parentNode !== null |
|
| 836 | 836 | && |
| 837 | 837 | !\in_array( |
| 838 | - $node->parentNode->nodeName, |
|
| 839 | - [ |
|
| 840 | - 'a', |
|
| 841 | - 'audio', |
|
| 842 | - 'del', |
|
| 843 | - 'ins', |
|
| 844 | - 'map', |
|
| 845 | - 'noscript', |
|
| 846 | - 'video', |
|
| 847 | - ], |
|
| 848 | - true |
|
| 849 | - ) |
|
| 850 | - ) |
|
| 851 | - ) |
|
| 838 | + $node->parentNode->nodeName, |
|
| 839 | + [ |
|
| 840 | + 'a', |
|
| 841 | + 'audio', |
|
| 842 | + 'del', |
|
| 843 | + 'ins', |
|
| 844 | + 'map', |
|
| 845 | + 'noscript', |
|
| 846 | + 'video', |
|
| 847 | + ], |
|
| 848 | + true |
|
| 849 | + ) |
|
| 850 | + ) |
|
| 851 | + ) |
|
| 852 | 852 | || |
| 853 | 853 | ( |
| 854 | - $nextSibling instanceof \DOMElement |
|
| 854 | + $nextSibling instanceof \DOMElement |
|
| 855 | 855 | && |
| 856 | 856 | \in_array( |
| 857 | - $nextSibling->tagName, |
|
| 858 | - [ |
|
| 859 | - 'address', |
|
| 860 | - 'article', |
|
| 861 | - 'aside', |
|
| 862 | - 'blockquote', |
|
| 863 | - 'dir', |
|
| 864 | - 'div', |
|
| 865 | - 'dl', |
|
| 866 | - 'fieldset', |
|
| 867 | - 'footer', |
|
| 868 | - 'form', |
|
| 869 | - 'h1', |
|
| 870 | - 'h2', |
|
| 871 | - 'h3', |
|
| 872 | - 'h4', |
|
| 873 | - 'h5', |
|
| 874 | - 'h6', |
|
| 875 | - 'header', |
|
| 876 | - 'hgroup', |
|
| 877 | - 'hr', |
|
| 878 | - 'menu', |
|
| 879 | - 'nav', |
|
| 880 | - 'ol', |
|
| 881 | - 'p', |
|
| 882 | - 'pre', |
|
| 883 | - 'section', |
|
| 884 | - 'table', |
|
| 885 | - 'ul', |
|
| 886 | - ], |
|
| 887 | - true |
|
| 888 | - ) |
|
| 889 | - ) |
|
| 890 | - ) |
|
| 891 | - ); |
|
| 857 | + $nextSibling->tagName, |
|
| 858 | + [ |
|
| 859 | + 'address', |
|
| 860 | + 'article', |
|
| 861 | + 'aside', |
|
| 862 | + 'blockquote', |
|
| 863 | + 'dir', |
|
| 864 | + 'div', |
|
| 865 | + 'dl', |
|
| 866 | + 'fieldset', |
|
| 867 | + 'footer', |
|
| 868 | + 'form', |
|
| 869 | + 'h1', |
|
| 870 | + 'h2', |
|
| 871 | + 'h3', |
|
| 872 | + 'h4', |
|
| 873 | + 'h5', |
|
| 874 | + 'h6', |
|
| 875 | + 'header', |
|
| 876 | + 'hgroup', |
|
| 877 | + 'hr', |
|
| 878 | + 'menu', |
|
| 879 | + 'nav', |
|
| 880 | + 'ol', |
|
| 881 | + 'p', |
|
| 882 | + 'pre', |
|
| 883 | + 'section', |
|
| 884 | + 'table', |
|
| 885 | + 'ul', |
|
| 886 | + ], |
|
| 887 | + true |
|
| 888 | + ) |
|
| 889 | + ) |
|
| 890 | + ) |
|
| 891 | + ); |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | protected function domNodeToString(\DOMNode $node): string |
@@ -920,9 +920,9 @@ discard block |
||
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | $html .= '<!DOCTYPE ' . $child->name . '' |
| 923 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
| 924 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
| 925 | - . '>'; |
|
| 923 | + . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
| 924 | + . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
| 925 | + . '>'; |
|
| 926 | 926 | } |
| 927 | 927 | } elseif ($child instanceof \DOMElement) { |
| 928 | 928 | $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function domElementAfterMinification(SimpleHtmlDomInterface $element, HtmlMinInterface $htmlMin) |
| 52 | 52 | { |
| 53 | - $tag_name = $element->getNode()->nodeName; |
|
| 53 | + $tag_name = $element->getNode()->nodeName; |
|
| 54 | 54 | $attributes = $element->getAllAttributes(); |
| 55 | 55 | if ($attributes === null) { |
| 56 | 56 | return; |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | $attrValue, |
| 69 | 69 | $attrName, |
| 70 | 70 | 'http', |
| 71 | - $attributes, |
|
| 72 | - $tag_name, |
|
| 71 | + $attributes, |
|
| 72 | + $tag_name, |
|
| 73 | 73 | $htmlMin |
| 74 | 74 | ); |
| 75 | 75 | } |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | $attrValue, |
| 80 | 80 | $attrName, |
| 81 | 81 | 'https', |
| 82 | - $attributes, |
|
| 83 | - $tag_name, |
|
| 82 | + $attributes, |
|
| 83 | + $tag_name, |
|
| 84 | 84 | $htmlMin |
| 85 | 85 | ); |
| 86 | 86 | } |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | string $attrValue, |
| 248 | 248 | string $attrName, |
| 249 | 249 | string $scheme, |
| 250 | - array $attributes, |
|
| 251 | - string $tag_name, |
|
| 250 | + array $attributes, |
|
| 251 | + string $tag_name, |
|
| 252 | 252 | HtmlMinInterface $htmlMin |
| 253 | 253 | ): string { |
| 254 | 254 | /** @noinspection InArrayCanBeUsedInspection */ |
@@ -261,12 +261,12 @@ discard block |
||
| 261 | 261 | ( |
| 262 | 262 | $attrName === 'href' |
| 263 | 263 | && |
| 264 | - ( |
|
| 265 | - !$htmlMin->isKeepPrefixOnExternalAttributes() |
|
| 266 | - || |
|
| 267 | - $tag_name === 'link' |
|
| 268 | - ) |
|
| 269 | - ) |
|
| 264 | + ( |
|
| 265 | + !$htmlMin->isKeepPrefixOnExternalAttributes() |
|
| 266 | + || |
|
| 267 | + $tag_name === 'link' |
|
| 268 | + ) |
|
| 269 | + ) |
|
| 270 | 270 | || |
| 271 | 271 | $attrName === 'src' |
| 272 | 272 | || |