function Scanner::__construct
Same name in this branch
- 11.1.x vendor/mck89/peast/lib/Peast/Syntax/Scanner.php \Peast\Syntax\Scanner::__construct()
Create a new Scanner.
Parameters
string $data Data to parse.:
string $encoding The encoding to use for the data.:
Throws
Exception If the given data cannot be encoded to UTF-8.
File
-
vendor/
masterminds/ html5/ src/ HTML5/ Parser/ Scanner.php, line 44
Class
- Scanner
- The scanner scans over a given data input to react appropriately to characters.
Namespace
Masterminds\HTML5\ParserCode
public function __construct($data, $encoding = 'UTF-8') {
if ($data instanceof InputStream) {
@trigger_error('InputStream objects are deprecated since version 2.4 and will be removed in 3.0. Use strings instead.', E_USER_DEPRECATED);
$data = (string) $data;
}
$data = UTF8Utils::convertToUTF8($data, $encoding);
// 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);
$data = $this->replaceLinefeeds($data);
$this->data = $data;
$this->char = 0;
$this->EOF = strlen($data);
}