@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $encoding |
|
| 23 | + */ |
|
| 21 | 24 | public function parse( $html, $encoding = null ) |
| 22 | 25 | { |
| 23 | 26 | if ( !$html ) { |
@@ -34,6 +37,9 @@ discard block |
||
| 34 | 37 | } |
| 35 | 38 | } |
| 36 | 39 | |
| 40 | + /** |
|
| 41 | + * @param string $html |
|
| 42 | + */ |
|
| 37 | 43 | private function parsePartial( $html, $encoding ) |
| 38 | 44 | { |
| 39 | 45 | $result = $this->parseFull( '<div id="ArcPartialHTML">'.$html.'</div>', $encoding ); |
@@ -45,6 +51,9 @@ discard block |
||
| 45 | 51 | return $result; |
| 46 | 52 | } |
| 47 | 53 | |
| 54 | + /** |
|
| 55 | + * @param boolean $prevErrorSetting |
|
| 56 | + */ |
|
| 48 | 57 | private function throwError($prevErrorSetting) |
| 49 | 58 | { |
| 50 | 59 | $errors = libxml_get_errors(); |
@@ -57,6 +66,9 @@ discard block |
||
| 57 | 66 | throw new \arc\Exception( $message, \arc\exceptions::ILLEGAL_ARGUMENT ); |
| 58 | 67 | } |
| 59 | 68 | |
| 69 | + /** |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 60 | 72 | private function insertEncoding($html, $encoding) |
| 61 | 73 | { |
| 62 | 74 | $meta = '<meta id="ArcTempEncoding" charset="'.htmlspecialchars($encoding).'">'; |
@@ -70,12 +82,18 @@ discard block |
||
| 70 | 82 | return $html; |
| 71 | 83 | } |
| 72 | 84 | |
| 85 | + /** |
|
| 86 | + * @param \DOMDocument $dom |
|
| 87 | + */ |
|
| 73 | 88 | private function removeEncoding( $dom, $encoding) |
| 74 | 89 | { |
| 75 | 90 | $meta = $dom->getElementById('ArcTempEncoding'); |
| 76 | 91 | $meta->parentNode->removeChild($meta); |
| 77 | 92 | } |
| 78 | 93 | |
| 94 | + /** |
|
| 95 | + * @param string $html |
|
| 96 | + */ |
|
| 79 | 97 | private function parseFull( $html, $encoding ) |
| 80 | 98 | { |
| 81 | 99 | $dom = new \DomDocument(); |