Sledgehammer Framework

TagIterator extends Base
in package
implements Iterator

Een iterator die de tags uit htmlcode haalt.

Met name geschikt voor html met fouten, zoals bijvoorbeeld een "header.php" waarbij een aantal tags niet worden gesloten. Met de uitvoer kun je de exacte (foute) html weer reconstrueren.

Vaak is een oplossing mogelijk met DOMDocument of SimpleXML. Gebruik in die gevallen niet deze iterator.

Interfaces, Classes, Traits and Enums

Iterator

Table of Contents

$warnings  : array<string|int, mixed>
Generated parser warnings. (The tokenizer doesn't report warnings, it just stores them in this array).
$key  : int
Iterator::key().
$tag  : array<string|int, mixed>
Iterator::current().
$tokenizer  : HtmlTokenizer
The tokenizer which proceesses the HTML.
$toLowercase  : bool
Convert tagnames to lowercase.
$valid  : bool
Iterator::valid().
__call()  : mixed
Report that the $method doesn't exist.
__callStatic()  : mixed
Report that the $method doesn't exist.
__construct()  : mixed
Constructor.
__get()  : mixed
Report that $property doesn't exist.
__set()  : mixed
Report that $property doesn't exist and set the property to the given $value.
__toString()  : string
The object is used as an string.
current()  : array<string|int, mixed>
Iterator::current().
key()  : int
Iterator::key().
next()  : mixed
Iterator::next().
rewind()  : mixed
Iterator::rewind().
valid()  : bool
Iterator::valid().
extractEntity()  : array<string|int, mixed>|string
Extract an entity like "<!DOCTYPE html>".
extractTag()  : array<string|int, mixed>
Extract an open or closing tag.

Properties

$warnings

Generated parser warnings. (The tokenizer doesn't report warnings, it just stores them in this array).

public array<string|int, mixed> $warnings

$tag

Iterator::current().

private array<string|int, mixed> $tag

$toLowercase

Convert tagnames to lowercase.

private bool $toLowercase

Methods

__call()

Report that the $method doesn't exist.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__callStatic()

Report that the $method doesn't exist.

public static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed

__construct()

Constructor.

public __construct(string $html[, bool $toLowercase = true ]) : mixed
Parameters
$html : string
$toLowercase : bool = true

Bij true worden alle tags en attributen omgezet naar lowercase. '<ImG SrC="TeSt">' wordt array('<img', array('src' => 'TeSt'),'>', 'html' => <ImG SrC='TeSt'>)

Return values
mixed

__get()

Report that $property doesn't exist.

public __get(string $property) : mixed
Parameters
$property : string
Return values
mixed

__set()

Report that $property doesn't exist and set the property to the given $value.

public __set(string $property, mixed $value) : mixed
Parameters
$property : string
$value : mixed
Return values
mixed

__toString()

The object is used as an string.

public __toString() : string
Return values
string

current()

Iterator::current().

public current() : array<string|int, mixed>
Return values
array<string|int, mixed>

key()

Iterator::key().

public key() : int
Return values
int

next()

Iterator::next().

public next() : mixed
Return values
mixed

rewind()

Iterator::rewind().

public rewind() : mixed
Return values
mixed

valid()

Iterator::valid().

public valid() : bool
Return values
bool

extractEntity()

Extract an entity like "<!DOCTYPE html>".

private extractEntity() : array<string|int, mixed>|string
Return values
array<string|int, mixed>|string

extractTag()

Extract an open or closing tag.

private extractTag() : array<string|int, mixed>
Return values
array<string|int, mixed>

token

Search results