Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Scanner.php

function Scanner::__construct

Same name in this branch
  1. 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\Parser

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal