API / Minn\Feed / Parts

Parts final class

Minn\Feed\Parts · public/minn/src/Minn/Feed/Parts.php · 140 lines

The repeating parts of a feed element read out of the tree as raw values: links by relation, categories, and enclosures (Media RSS contents, Atom enclosure links, RSS enclosures). The feed object sanitizes and wraps them; each raw value travels with the node it came from, so a relative URL resolves against that node's base.

Uses 1

Constants and properties

constIANA = 'http://www.iana.org/assignments/relation/'
constMEDIA = 'http://search.yahoo.com/mrss/'
privateDC = array ( 0 => 'http://purl.org/dc/elements/1.1/', 1 => 'http://purl.org/dc/elements/1.0/', )

Public

staticlinks(array $child, array $plain, array $more, Closure $iri): array#

Links by relation: Atom links (rel defaults to alternate, IANA names answer to both spellings), then the RSS-style link elements and the given extra alternates.

$childarray<string, array<string, list<array<string, mixed>>>>the element's children
$plainlist<array{0: string, 1: string}>RSS-style link tags, by namespace and name
$morelist<string>alternates already in their final form
$iriClosure(string, array<string, mixed>): stringa URL as the feed hands it out, given its node
@return array<string, list<string>>
staticcategories(array $child): array#

Categories as raw text: Atom (term, scheme, label), RSS 2.0 (the text, the domain as scheme), Dublin Core subjects.

$childarray<string, array<string, list<array<string, mixed>>>>
@return list<array{term: ?string, scheme: ?string, label: ?string, type: string}>
staticenclosures(array $item): array#

An item's enclosures as raw fields, Media RSS contents first (with the item's thumbnails when a content has none of its own), then Atom enclosure links, then RSS enclosures. "node" is where the URL came from.

$itemarray<string, mixed>the item's node
@return list<array<string, mixed>>
staticthumbnails(array $node): array#

The media:thumbnail URLs directly under an element, each with its node.

$nodearray<string, mixed>
@return list<array{0: string, 1: array<string, mixed>}>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatemedia(array $node, array $thumbnails): array#
$nodearray<string, mixed>a media:content element
$thumbnailslist<array{0: string, 1: array<string, mixed>}>
@return array<string, mixed>