annotate vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
rev   line source
Chris@0 1 <?php
Chris@4 2
Chris@0 3 namespace Masterminds\HTML5\Parser;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * The FileInputStream loads a file to be parsed.
Chris@0 7 *
Chris@0 8 * So right now we read files into strings and then process the
Chris@0 9 * string. We chose to do this largely for the sake of expediency of
Chris@0 10 * development, and also because we could optimize toward processing
Chris@0 11 * arbitrarily large chunks of the input. But in the future, we'd
Chris@0 12 * really like to rewrite this class to efficiently handle lower level
Chris@0 13 * stream reads (and thus efficiently handle large documents).
Chris@0 14 *
Chris@4 15 * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead.
Chris@0 16 */
Chris@0 17 class FileInputStream extends StringInputStream implements InputStream
Chris@0 18 {
Chris@0 19 /**
Chris@0 20 * Load a file input stream.
Chris@0 21 *
Chris@4 22 * @param string $data The file or url path to load.
Chris@4 23 * @param string $encoding The encoding to use for the data.
Chris@4 24 * @param string $debug A fprintf format to use to echo the data on stdout.
Chris@0 25 */
Chris@0 26 public function __construct($data, $encoding = 'UTF-8', $debug = '')
Chris@0 27 {
Chris@0 28 // Get the contents of the file.
Chris@0 29 $content = file_get_contents($data);
Chris@0 30
Chris@0 31 parent::__construct($content, $encoding, $debug);
Chris@0 32 }
Chris@0 33 }