API / Minn\Feed / Tree

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.

Used by 2

Constants and properties

constXML = 'http://www.w3.org/XML/1998/namespace'
constATOM_10 = 'http://www.w3.org/2005/Atom'
constATOM_03 = 'http://purl.org/atom/ns#'
constRSS_10 = 'http://purl.org/rss/1.0/'
constRSS_090 = 'http://my.netscape.com/rdf/simple/0.9/'
privateSEPARATOR = ''
privateVOID = 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', )
privatearray $stack
privatearray $root
privateint $xhtmlDepth

Public

staticparse(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.

privateprepare(string $xml): string#

The document as the parser reads it: HTML references made numeric, the declaration on a line of its own.

privatebuild(string $xml): array#
@return array{child: array<string, array<string, list<array<string, mixed>>>>}
privateopen(XMLParser $parser, string $name, array $attributes): void#
privateclose(XMLParser $parser, string $name): void#
privatetext(XMLParser $parser, string $text): void#
privateappend(string $text): void#
privatesplit(string $name): array#
@return array{0: string, 1: string} namespace and local name
privatemarkupAttributes(array $attributes): string#