Tree final class
Minn\Feed\Tree · public/minn/src/Minn/Feed/Tree.php · 146 lines
A feed document parsed into the nested arrays plugin code reads through get_item_tags() and friends: each element is a node holding its own text ("data", whitespace between children included), its attributes grouped by namespace, the xml:base and xml:lang in force, and its children by namespace and local name. Two shapes differ from plain XML: an Atom text construct of type "xhtml" keeps its markup as text, and an RSS title is stored HTML-escaped. Named HTML references are read as characters unless the document brings its own DOCTYPE.
Constants and properties
| const | XML = 'http://www.w3.org/XML/1998/namespace' | |
| const | ATOM_10 = 'http://www.w3.org/2005/Atom' | |
| const | ATOM_03 = 'http://purl.org/atom/ns#' | |
| const | RSS_10 = 'http://purl.org/rss/1.0/' | |
| const | RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/' | |
| private | SEPARATOR = '' | |
| private | VOID = array ( 0 => 'area', 1 => 'base', 2 => 'br', 3 => 'col', 4 => 'embed', 5 => 'hr', 6 => 'img', 7 => 'input', 8 => 'link', 9 => 'meta', 10 => 'param', 11 => 'source', 12 => 'track', 13 => 'wbr', ) | |
| private | array $stack | |
| private | array $root | |
| private | int $xhtmlDepth |
Public
| static | parse(string $utf8): array# | The document's elements under a root holding only "child". @return array{child: array<string, array<string, list<array<string, mixed>>>>} |
Internals 8
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | prepare(string $xml): string# | The document as the parser reads it: HTML references made numeric, the declaration on a line of its own. |
| private | build(string $xml): array# | @return array{child: array<string, array<string, list<array<string, mixed>>>>} |
| private | open(XMLParser $parser, string $name, array $attributes): void# | |
| private | close(XMLParser $parser, string $name): void# | |
| private | text(XMLParser $parser, string $text): void# | |
| private | append(string $text): void# | |
| private | split(string $name): array# | @return array{0: string, 1: string} namespace and local name |
| private | markupAttributes(array $attributes): string# |
Nothing matches.