diff options
author | Matt Farina <[email protected]> | 2013-04-16 09:39:02 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-04-16 09:39:02 -0400 |
commit | 2af1f6ef4f50a22861a8ec78ed2defb72913cab7 (patch) | |
tree | 34e5013f1620ac0a6b0167c952b237a4a38b6574 /src/HTML5 | |
parent | 391e4f31e3f0e7935a46431783896153156a65eb (diff) |
Added a FileInputStream for anything that can be grabbed by file_get_contents.
Diffstat (limited to 'src/HTML5')
-rw-r--r-- | src/HTML5/Parser/FileInputStream.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/HTML5/Parser/FileInputStream.php b/src/HTML5/Parser/FileInputStream.php new file mode 100644 index 0000000..ae3b4ef --- /dev/null +++ b/src/HTML5/Parser/FileInputStream.php @@ -0,0 +1,26 @@ +<?php +namespace HTML5\Parser; + +/** + * The FileInputStream loads a file to be parsed. + * + * @todo A buffered input stream would be useful. + */ +class FileInputStream extends StringInputStream implements InputStream { + + /** + * Load a file input stream. + * + * @param string $data + * The file or url path to load. + */ + function __construct($data, $encoding = 'UTF-8', $debug = '') { + + // Get the contents of the file. + $content = file_get_contents($data); + + parent::__construct($content, $encoding, $debug); + + } + +}
\ No newline at end of file |