summaryrefslogtreecommitdiff
path: root/src/HTML5.php
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-15 13:57:25 -0400
committerMatt Farina <[email protected]>2013-05-15 13:57:25 -0400
commit4ac18627abe1d60f0a675914cb91eec2b8f4bcb8 (patch)
tree5ad5770d9593836bd84abad3f8a198505ea526c5 /src/HTML5.php
parent0cdf4ae1aaf6aefdc7218dbb49e543e8603035a8 (diff)
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.
Diffstat (limited to 'src/HTML5.php')
-rw-r--r--src/HTML5.php16
1 files changed, 8 insertions, 8 deletions
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);