From 4ac18627abe1d60f0a675914cb91eec2b8f4bcb8 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 15 May 2013 13:57:25 -0400 Subject: Updated the \HTML5 class to parse with static methods, updated the Traverser tests to work with the the new parser, and remoted the old Parser tests not that the old parser is gone. --- src/HTML5.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/HTML5.php') diff --git a/src/HTML5.php b/src/HTML5.php index 23948b3..9407e84 100644 --- a/src/HTML5.php +++ b/src/HTML5.php @@ -38,16 +38,16 @@ class HTML5 { * A DOM document. These object type is defined by the libxml * library, and should have been included with your version of PHP. */ - public function load($file, $options = NULL) { + public static function load($file, $options = NULL) { // Handle the case where file is a resource. if (is_resource($file)) { // FIXME: We need a StreamInputStream class. - return $this->loadHTML(stream_get_contents($file)); + return self::loadHTML(stream_get_contents($file)); } $input = new FileInputStream($file); - return $this->parse($input); + return self::parse($input); } /** @@ -63,9 +63,9 @@ class HTML5 { * A DOM document. DOM is part of libxml, which is included with * almost all distribtions of PHP. */ - public function loadHTML($string, $options = NULL) { + public static function loadHTML($string, $options = NULL) { $input = new StringInputStream($string); - return $this->parse($input); + return self::parse($input); } /** @@ -74,8 +74,8 @@ class HTML5 { * This is here to provide backwards compatibility with the * PHP DOM implementation. It simply calls load(). */ - public function loadHTMLFile($file, $options = NULL) { - return $this->load($file, $options); + public static function loadHTMLFile($file, $options = NULL) { + return self::load($file, $options); } /** @@ -97,7 +97,7 @@ class HTML5 { /** * Parse an input stream. */ - protected function parse($input) { + public static function parse($input) { $events = new DOMTreeBuilder(); $scanner = new Scanner($input); $parser = new Tokenizer($scanner, $events); -- cgit v1.2.3