From 273235b13c072713052e5845ff107e9f197c4d61 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Thu, 26 Sep 2013 12:23:22 -0400 Subject: The serializer was a wrapper for serializing the same way html5 at the top level was a wrapper for parsing. Moved the serializing interface to be in the same form as the parser for consistency. --- src/HTML5/Serializer/Serializer.php | 82 ------------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 src/HTML5/Serializer/Serializer.php (limited to 'src/HTML5/Serializer/Serializer.php') diff --git a/src/HTML5/Serializer/Serializer.php b/src/HTML5/Serializer/Serializer.php deleted file mode 100644 index 7d1e7b2..0000000 --- a/src/HTML5/Serializer/Serializer.php +++ /dev/null @@ -1,82 +0,0 @@ -dom = $dom; - $this->options = $options; - } - - /** - * Save to a file. - * - * @param mixed $filename - * A file handle resource or the - * full name to the file. This will overwrite the contents of - * any file that it finds. - */ - public function save($filename) { - $close = TRUE; - if (is_resource($filename)) { - $file = $filename; - $close = FALSE; - } - else { - $file = fopen($filename, 'w'); - } - $rules = new OutputRules($file, $this->options); - $trav = new Traverser($this->dom, $file, $rules, $this->options); - - $trav->walk(); - - if ($close) { - fclose($file); - } - } - - /** - * Return the DOM as an HTML5 string. - */ - public function saveHTML() { - // We buffer into a temp-file backed memory map. This may or may not be - // faster than writing directly to a string, but it makes the interface - // consistant and will keep memory consumption lower (2MB max for the file - // buffer). - $stream = fopen('php://temp', 'w'); - $this->save($stream); - return stream_get_contents($stream, -1, 0); - } -} -- cgit v1.2.3