else { $stream =
fopen($file, 'wb'
);
} $options =
array_merge($this->defaultOptions,
$options);
$rules =
new OutputRules($stream,
$options);
$trav =
new Traverser($dom,
$stream,
$rules,
$options);
$trav->
walk();
/*
* release the traverser to avoid cyclic references and allow PHP to free memory without waiting for gc_collect_cycles
*/
$rules->
unsetTraverser();
if ($close) { fclose($stream);
} } /**
* Convert a DOM into an HTML5 string.
*
* @param mixed $dom The DOM to be serialized.
* @param array $options Configuration options when serializing the DOM. These include:
* - encode_entities: Text written to the output is escaped by default and not all
* entities are encoded. If this is set to true all entities will be encoded.
* Defaults to false.
*
* @return string A HTML5 documented generated from the DOM.
*/