| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | ); |
| 27 | 27 | protected $errors = array(); |
| 28 | 28 | public function __construct(array $defaultOptions = array()) |
| 29 | 29 | { |
| 30 | - $this->defaultOptions = \array_merge($this->defaultOptions, $defaultOptions); | |
| 30 | + $this->defaultOptions = array_merge($this->defaultOptions, $defaultOptions); | |
| 31 | 31 | } |
| 32 | 32 | /** |
| 33 | 33 | * Get the current default options. |
| 34 | 34 | * |
| @@ -58,12 +58,12 @@ | ||
| 58 | 58 | */ |
| 59 | 59 | public function load($file, array $options = array()) |
| 60 | 60 | { |
| 61 | 61 | // Handle the case where file is a resource. |
| 62 | - if (\is_resource($file)) { | |
| 63 | - return $this->parse(\stream_get_contents($file), $options); | |
| 62 | + if (is_resource($file)) { | |
| 63 | + return $this->parse(stream_get_contents($file), $options); | |
| 64 | 64 | } |
| 65 | - return $this->parse(\file_get_contents($file), $options); | |
| 65 | + return $this->parse(file_get_contents($file), $options); | |
| 66 | 66 | } |
| 67 | 67 | /** |
| 68 | 68 | * Parse a HTML Document from a string. |
| 69 | 69 | * |
| @@ -126,15 +126,14 @@ | ||
| 126 | 126 | * @return bool |
| 127 | 127 | */ |
| 128 | 128 | public function hasErrors() |
| 129 | 129 | { |
| 130 | - return \count($this->errors) > 0; | |
| 130 | + return count($this->errors) > 0; | |
| 131 | 131 | } |
| 132 | 132 | /** |
| 133 | 133 | * Parse an input string. |
| 134 | 134 | * |
| 135 | 135 | * @param string $input |
| 136 | - * @param array $options | |
| 137 | 136 | * |
| 138 | 137 | * @return \DOMDocument |
| 139 | 138 | */ |
| 140 | 139 | public function parse($input, array $options = array()) |
| @@ -139,9 +138,9 @@ | ||
| 139 | 138 | */ |
| 140 | 139 | public function parse($input, array $options = array()) |
| 141 | 140 | { |
| 142 | 141 | $this->errors = array(); |
| 143 | - $options = \array_merge($this->defaultOptions, $options); | |
| 142 | + $options = array_merge($this->defaultOptions, $options); | |
| 144 | 143 | $events = new DOMTreeBuilder(\false, $options); |
| 145 | 144 | $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); |
| 146 | 145 | $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); |
| 147 | 146 | $parser->parse(); |
| @@ -160,9 +159,9 @@ | ||
| 160 | 159 | * @return \DOMDocumentFragment |
| 161 | 160 | */ |
| 162 | 161 | public function parseFragment($input, array $options = array()) |
| 163 | 162 | { |
| 164 | - $options = \array_merge($this->defaultOptions, $options); | |
| 163 | + $options = array_merge($this->defaultOptions, $options); | |
| 165 | 164 | $events = new DOMTreeBuilder(\true, $options); |
| 166 | 165 | $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); |
| 167 | 166 | $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); |
| 168 | 167 | $parser->parse(); |
| @@ -181,15 +180,15 @@ | ||
| 181 | 180 | */ |
| 182 | 181 | public function save($dom, $file, $options = array()) |
| 183 | 182 | { |
| 184 | 183 | $close = \true; |
| 185 | - if (\is_resource($file)) { | |
| 184 | + if (is_resource($file)) { | |
| 186 | 185 | $stream = $file; |
| 187 | 186 | $close = \false; |
| 188 | 187 | } else { |
| 189 | - $stream = \fopen($file, 'wb'); | |
| 188 | + $stream = fopen($file, 'wb'); | |
| 190 | 189 | } |
| 191 | - $options = \array_merge($this->defaultOptions, $options); | |
| 190 | + $options = array_merge($this->defaultOptions, $options); | |
| 192 | 191 | $rules = new OutputRules($stream, $options); |
| 193 | 192 | $trav = new Traverser($dom, $stream, $rules, $options); |
| 194 | 193 | $trav->walk(); |
| 195 | 194 | /* |
| @@ -196,9 +195,9 @@ | ||
| 196 | 195 | * release the traverser to avoid cyclic references and allow PHP to free memory without waiting for gc_collect_cycles |
| 197 | 196 | */ |
| 198 | 197 | $rules->unsetTraverser(); |
| 199 | 198 | if ($close) { |
| 200 | - \fclose($stream); | |
| 199 | + fclose($stream); | |
| 201 | 200 | } |
| 202 | 201 | } |
| 203 | 202 | /** |
| 204 | 203 | * Convert a DOM into an HTML5 string. |
| @@ -212,11 +211,11 @@ | ||
| 212 | 211 | * @return string A HTML5 documented generated from the DOM. |
| 213 | 212 | */ |
| 214 | 213 | public function saveHTML($dom, $options = array()) |
| 215 | 214 | { |
| 216 | - $stream = \fopen('php://temp', 'wb'); | |
| 217 | - $this->save($dom, $stream, \array_merge($this->defaultOptions, $options)); | |
| 218 | - $html = \stream_get_contents($stream, -1, 0); | |
| 219 | - \fclose($stream); | |
| 215 | + $stream = fopen('php://temp', 'wb'); | |
| 216 | + $this->save($dom, $stream, array_merge($this->defaultOptions, $options)); | |
| 217 | + $html = stream_get_contents($stream, -1, 0); | |
| 218 | + fclose($stream); | |
| 220 | 219 | return $html; |
| 221 | 220 | } |
| 222 | 221 | } |