diff options
author | Matt Butcher <[email protected]> | 2014-02-11 09:56:01 -0700 |
---|---|---|
committer | Matt Butcher <[email protected]> | 2014-02-11 09:56:01 -0700 |
commit | 44e8e23626bf619844baf9983e931d2f58606377 (patch) | |
tree | 62625f63a954ab5a3f9bb4184039a68496e3896a /src/HTML5.php | |
parent | 77ad931cd824feb33eebae08cf3a5a47bce1e337 (diff) | |
parent | 3b691837c6d7a0969137048fbda274463d6b1d7c (diff) |
Merge branch 'master' of github.com:Masterminds/html5-php
Diffstat (limited to 'src/HTML5.php')
-rw-r--r-- | src/HTML5.php | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/HTML5.php b/src/HTML5.php index ce0927f..7295fb4 100644 --- a/src/HTML5.php +++ b/src/HTML5.php @@ -1,5 +1,7 @@ <?php - +/** + * The main HTML5 front end. + */ use HTML5\Parser\StringInputStream; use HTML5\Parser\FileInputStream; use HTML5\Parser\Scanner; @@ -9,8 +11,6 @@ use HTML5\Serializer\OutputRules; use HTML5\Serializer\Traverser; /** - * The main HTML5 front end. - * * This class offers convenience methods for parsing and serializing HTML5. * It is roughly designed to mirror the \DOMDocument class that is * provided with most versions of PHP. @@ -19,6 +19,10 @@ use HTML5\Serializer\Traverser; */ class HTML5 { + /** + * Global options for the parser and serializer. + * @var array + */ public static $options = array( // If the serializer should encode all entities. @@ -77,6 +81,15 @@ class HTML5 { * * This is here to provide backwards compatibility with the * PHP DOM implementation. It simply calls load(). + * + * @param string $file + * The path to the file to parse. If this is a resource, it is + * assumed to be an open stream whose pointer is set to the first + * byte of input. + * + * @return \DOMDocument + * A DOM document. These object type is defined by the libxml + * library, and should have been included with your version of PHP. */ public static function loadHTMLFile($file, $options = NULL) { return static::load($file, $options); @@ -166,6 +179,12 @@ class HTML5 { return $events->document(); } + /** + * Parse an input stream where the stream is a fragment. + * + * Lower-level loading function. This requires an input stream instead + * of a string, file, or resource. + */ public static function parseFragment(\HTML5\Parser\InputStream $input) { $events = new DOMTreeBuilder(TRUE); $scanner = new Scanner($input); |