You are here

public function StringInputStream::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php \Masterminds\HTML5\Parser\StringInputStream::__construct()

Create a new InputStream wrapper.

Parameters

$data Data: to parse

1 call to StringInputStream::__construct()
FileInputStream::__construct in vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php
Load a file input stream.
1 method overrides StringInputStream::__construct()
FileInputStream::__construct in vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php
Load a file input stream.

File

vendor/masterminds/html5/src/HTML5/Parser/StringInputStream.php, line 71

Class

StringInputStream

Namespace

Masterminds\HTML5\Parser

Code

public function __construct($data, $encoding = 'UTF-8', $debug = '') {
  $data = UTF8Utils::convertToUTF8($data, $encoding);
  if ($debug) {
    fprintf(STDOUT, $debug, $data, strlen($data));
  }

  // There is good reason to question whether it makes sense to
  // do this here, since most of these checks are done during
  // parsing, and since this check doesn't actually *do* anything.
  $this->errors = UTF8Utils::checkForIllegalCodepoints($data);

  // if (!empty($e)) {
  // throw new ParseError("UTF-8 encoding issues: " . implode(', ', $e));
  // }
  $data = $this
    ->replaceLinefeeds($data);
  $this->data = $data;
  $this->char = 0;
  $this->EOF = strlen($data);
}