Skip to content

Commit 76f537d

Browse files
authored
Merge pull request #105 from nb823/podcastindex_live_item
Podcastindex Live Item
2 parents 46c8f68 + 873ec63 commit 76f537d

File tree

22 files changed

+4482
-470
lines changed

22 files changed

+4482
-470
lines changed

docs/book/extensions/podcast-index.md

Lines changed: 56 additions & 10 deletions
Large diffs are not rendered by default.

psalm-baseline.xml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,7 @@
528528
<code><![CDATA[$entry->ownerDocument]]></code>
529529
</PossiblyNullPropertyAssignmentValue>
530530
<PossiblyUnusedMethod>
531-
<code>__call</code>
532531
<code>getExtensions</code>
533-
<code>getXpath</code>
534532
<code>saveXml</code>
535533
</PossiblyUnusedMethod>
536534
<PropertyNotSetInConstructor>
@@ -1586,6 +1584,9 @@
15861584
</TooManyArguments>
15871585
</file>
15881586
<file src="src/Reader/Extension/PodcastIndex/Feed.php">
1587+
<DeprecatedMethod>
1588+
<code>getPodcastIndexFunding</code>
1589+
</DeprecatedMethod>
15891590
<MixedAssignment>
15901591
<code>$locked</code>
15911592
<code>$owner</code>
@@ -1606,6 +1607,14 @@
16061607
<code>query</code>
16071608
</TooManyArguments>
16081609
</file>
1610+
<file src="src/Reader/Extension/PodcastIndex/LiveItem.php">
1611+
<PossiblyUnusedMethod>
1612+
<code>registerNamespaces</code>
1613+
</PossiblyUnusedMethod>
1614+
<PropertyNotSetInConstructor>
1615+
<code>LiveItem</code>
1616+
</PropertyNotSetInConstructor>
1617+
</file>
16091618
<file src="src/Reader/Extension/Slash/Entry.php">
16101619
<InvalidOperand>
16111620
<code>$hit</code>
@@ -3079,13 +3088,6 @@
30793088
</TypeDoesNotContainType>
30803089
</file>
30813090
<file src="src/Writer/Extension/PodcastIndex/Entry.php">
3082-
<DocblockTypeContradiction>
3083-
<code><![CDATA[! is_string($value['duration'])]]></code>
3084-
<code><![CDATA[! is_string($value['startTime'])]]></code>
3085-
</DocblockTypeContradiction>
3086-
<MixedArrayAssignment>
3087-
<code><![CDATA[$this->data['soundbites'][]]]></code>
3088-
</MixedArrayAssignment>
30893091
<PossiblyUnusedMethod>
30903092
<code>__construct</code>
30913093
<code>addPodcastIndexAlternateEnclosure</code>
@@ -3097,10 +3099,13 @@
30973099
<code>resetPodcastIndexValues</code>
30983100
<code>setEncoding</code>
30993101
<code>setPodcastIndexChapters</code>
3102+
<code>setPodcastIndexChat</code>
3103+
<code>setPodcastIndexContentLinks</code>
31003104
<code>setPodcastIndexDetailedImages</code>
31013105
<code>setPodcastIndexEpisode</code>
3106+
<code>setPodcastIndexFundings</code>
31023107
<code>setPodcastIndexLicense</code>
3103-
<code>setPodcastIndexLocation</code>
3108+
<code>setPodcastIndexLocations</code>
31043109
<code>setPodcastIndexPersons</code>
31053110
<code>setPodcastIndexSeason</code>
31063111
<code>setPodcastIndexSocialInteracts</code>
@@ -3118,21 +3123,28 @@
31183123
<file src="src/Writer/Extension/PodcastIndex/Feed.php">
31193124
<PossiblyUnusedMethod>
31203125
<code>__construct</code>
3121-
<code>addPodcastIndexPodrollRemoteItem</code>
3126+
<code>addPodcastIndexLiveItem</code>
31223127
<code>addPodcastIndexValue</code>
3123-
<code>getEncoding</code>
3128+
<code>createPodcastIndexLiveItem</code>
31243129
<code>getLockOwner</code>
3130+
<code>getPodcastIndexFundings</code>
3131+
<code>getPodcastIndexLiveItems</code>
3132+
<code>getPodcastIndexLocations</code>
31253133
<code>getPodcastIndexPersons</code>
31263134
<code>isLocked</code>
3135+
<code>removePodcastIndexLiveItem</code>
31273136
<code>resetPodcastIndexValues</code>
31283137
<code>setEncoding</code>
31293138
<code>setPodcastIndexBlocks</code>
3139+
<code>setPodcastIndexChat</code>
31303140
<code>setPodcastIndexDetailedImages</code>
31313141
<code>setPodcastIndexFunding</code>
3142+
<code>setPodcastIndexFundings</code>
31323143
<code>setPodcastIndexGuid</code>
31333144
<code>setPodcastIndexImages</code>
31343145
<code>setPodcastIndexLicense</code>
31353146
<code>setPodcastIndexLocation</code>
3147+
<code>setPodcastIndexLocations</code>
31363148
<code>setPodcastIndexLocked</code>
31373149
<code>setPodcastIndexMedium</code>
31383150
<code>setPodcastIndexPersons</code>
@@ -3149,9 +3161,33 @@
31493161
<code>$params</code>
31503162
</PossiblyUnusedParam>
31513163
<PossiblyUnusedProperty>
3164+
<code>$liveItemKey</code>
31523165
<code>$stringWrapper</code>
31533166
</PossiblyUnusedProperty>
31543167
</file>
3168+
<file src="src/Writer/Extension/PodcastIndex/LiveItem.php">
3169+
<PossiblyUnusedMethod>
3170+
<code>setEnd</code>
3171+
<code>setStart</code>
3172+
<code>setStatus</code>
3173+
</PossiblyUnusedMethod>
3174+
<PossiblyUnusedProperty>
3175+
<code>$encoding</code>
3176+
</PossiblyUnusedProperty>
3177+
</file>
3178+
<file src="src/Writer/Extension/PodcastIndex/Renderer/LiveItem.php">
3179+
<MixedAssignment>
3180+
<code>$ext</code>
3181+
</MixedAssignment>
3182+
<MixedMethodCall>
3183+
<code>render</code>
3184+
<code>setDataContainer</code>
3185+
<code>setDomDocument</code>
3186+
<code>setEncoding</code>
3187+
<code>setRootElement</code>
3188+
<code>setType</code>
3189+
</MixedMethodCall>
3190+
</file>
31553191
<file src="src/Writer/Extension/RendererInterface.php">
31563192
<PossiblyUnusedMethod>
31573193
<code>render</code>

src/Reader/Extension/PodcastIndex/AttributesReader.php

Lines changed: 117 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,142 +15,159 @@
1515
* This class is internal to the library and should not be referenced by consumer code.
1616
* Backwards Incompatible changes can occur in Minor and Patch Releases.
1717
*
18+
* @internal
19+
*
20+
* @psalm-internal Laminas\Feed
21+
* @psalm-internal LaminasTest\Feed
22+
*
23+
* @psalm-type FundingObject = object{
24+
* title: string,
25+
* url: string
26+
* }
1827
* @psalm-type LicenseObject = object{
1928
* identifier: string,
20-
* url?: string
29+
* url: string
2130
* }
2231
* @psalm-type LocationObject = object{
2332
* description: string,
24-
* geo?: string,
25-
* osm?: string,
26-
* rel?: string,
27-
* country?: string,
33+
* geo: string,
34+
* osm: string,
35+
* rel: string,
36+
* country: string,
2837
* }
2938
* @psalm-type BlockObject = object{
3039
* value: string,
31-
* id?: string
40+
* id: string
3241
* }
3342
* @psalm-type TxtObject = object{
3443
* value: string,
35-
* purpose?: string
44+
* purpose: string
3645
* }
3746
* @psalm-type UpdateFrequencyObject = object{
3847
* description: string,
39-
* complete?: bool,
40-
* dtstart?: DateTimeInterface,
41-
* rrule?: string
48+
* complete: bool,
49+
* dtstart: DateTimeInterface,
50+
* rrule: string
4251
* }
4352
* @psalm-type PersonObject = object{
4453
* name: string,
45-
* role?: string,
46-
* group?: string,
47-
* img?: string,
48-
* href?: string
54+
* role: string,
55+
* group: string,
56+
* img: string,
57+
* href: string
4958
* }
5059
* @psalm-type TrailerObject = object{
5160
* title: string,
5261
* pubdate: string,
5362
* url: string,
54-
* length?: int,
55-
* type?: string,
56-
* season?: int
63+
* length: int,
64+
* type: string,
65+
* season: int
5766
* }
5867
* @psalm-type RemoteItemObject = object{
5968
* feedGuid: string,
60-
* feedUrl?: string,
61-
* itemGuid?: string,
62-
* medium?: string,
63-
* title?: string
69+
* feedUrl: string,
70+
* itemGuid: string,
71+
* medium: string,
72+
* title: string
6473
* }
6574
* @psalm-type ValueRecipientObject = object{
6675
* type: string,
6776
* address: string,
6877
* split: int,
69-
* name?: string,
70-
* customKey?: string,
71-
* customValue?: string,
72-
* fee?: bool,
78+
* name: string,
79+
* customKey: string,
80+
* customValue: string,
81+
* fee: bool,
7382
* }
7483
* @psalm-type ValueTimeSplitObject = object{
7584
* startTime: int,
7685
* duration: int,
77-
* remoteStartTime?: int,
78-
* remotePercentage?: int,
79-
* valueRecipients?: list<ValueRecipientObject>,
80-
* remoteItem?: RemoteItemObject
86+
* remoteStartTime: int,
87+
* remotePercentage: int,
88+
* valueRecipients: list<ValueRecipientObject>,
89+
* remoteItem: RemoteItemObject
8190
* }
8291
* @psalm-type ValueObject = object{
8392
* type: string,
8493
* method: string,
85-
* suggested?: float,
94+
* suggested: float,
8695
* valueRecipients: list<ValueRecipientObject>,
87-
* valueTimeSplits?: list<ValueTimeSplitObject>,
96+
* valueTimeSplits: list<ValueTimeSplitObject>,
8897
* }
8998
* @psalm-type ImagesObject = object{
9099
* srcset: string,
91100
* }
92101
* @psalm-type DetailedImageObject = object{
93102
* href: string,
94-
* alt?: string,
95-
* purpose?: string,
96-
* type?: string,
97-
* aspectRatio?: string,
98-
* width?: int,
99-
* height?: int,
103+
* alt: string,
104+
* purpose: string,
105+
* type: string,
106+
* aspectRatio: string,
107+
* width: int,
108+
* height: int,
100109
* }
101110
* @psalm-type SocialInteractObject = object{
102111
* protocol: string,
103112
* uri: string,
104-
* priority?: int,
105-
* accountId?: string,
106-
* accountUrl?: string,
113+
* priority: int,
114+
* accountId: string,
115+
* accountUrl: string,
107116
* }
108117
* @psalm-type TranscriptObject = object{
109118
* url: string,
110119
* type: string,
111-
* language?: string,
112-
* rel?: string
120+
* language: string,
121+
* rel: string
113122
* }
114123
* @psalm-type ChaptersObject = object{
115124
* url: string,
116125
* type: string
117126
* }
118127
* @psalm-type SoundbiteObject = object{
119-
* title?: string,
128+
* title: string,
120129
* startTime: string,
121130
* duration: string
122131
* }
123132
* @psalm-type SeasonObject = object{
124133
* value: int,
125-
* name?: string
134+
* name: string
126135
* }
127136
* @psalm-type EpisodeObject = object{
128137
* value: int|float,
129-
* display?: string
138+
* display: string
130139
* }
131140
* @psalm-type SourceObject = object{
132141
* uri: string,
133-
* contentType?: string
142+
* contentType: string
134143
* }
135144
* @psalm-type IntegrityObject = object{
136145
* type: string,
137146
* value: string
138147
* }
139148
* @psalm-type AlternateEnclosureObject = object{
140149
* type: string,
141-
* length?: int,
142-
* bitrate?: int|float,
143-
* height?: int,
144-
* lang?: string,
145-
* title?: string,
146-
* rel?: string,
147-
* codecs?: string,
148-
* default?: bool,
149-
* sources: list<SourceObject>,
150-
* integrity?: IntegrityObject,
151-
* }
152-
* @psalm-internal Laminas\Feed
153-
* @psalm-internal LaminasTest\Feed
150+
* length: int,
151+
* bitrate: int|float,
152+
* height: int,
153+
* lang: string,
154+
* title: string,
155+
* rel: string,
156+
* codecs: string,
157+
* default: bool,
158+
* sources: list<SourceObject>,
159+
* integrity: IntegrityObject,
160+
* }
161+
* @psalm-type ContentLinkObject = object{
162+
* href: string,
163+
* description: string,
164+
* }
165+
* @psalm-type ChatObject = object{
166+
* server: string,
167+
* protocol: string,
168+
* accountId: string,
169+
* space: string,
170+
* }
154171
*/
155172
final class AttributesReader
156173
{
@@ -443,4 +460,45 @@ public static function readIntegrity(DOMElement $item): object
443460
$object->value = $item->getAttribute('value');
444461
return $object;
445462
}
463+
464+
/**
465+
* Read content link
466+
*
467+
* @psalm-return ContentLinkObject
468+
*/
469+
public static function readContentLink(DOMElement $item): object
470+
{
471+
$object = new stdClass();
472+
$object->href = $item->getAttribute('href');
473+
$object->description = $item->nodeValue;
474+
return $object;
475+
}
476+
477+
/**
478+
* Read podcast funding
479+
*
480+
* @psalm-return FundingObject
481+
*/
482+
public static function readFunding(DOMElement $item): object
483+
{
484+
$object = new stdClass();
485+
$object->url = $item->getAttribute('url');
486+
$object->title = $item->nodeValue;
487+
return $object;
488+
}
489+
490+
/**
491+
* Read podcast chat
492+
*
493+
* @psalm-return ChatObject
494+
*/
495+
public static function readChat(DOMElement $item): object
496+
{
497+
$object = new stdClass();
498+
$object->server = $item->getAttribute('server');
499+
$object->protocol = $item->getAttribute('protocol');
500+
$object->accountId = $item->getAttribute('accountId');
501+
$object->space = $item->getAttribute('space');
502+
return $object;
503+
}
446504
}

0 commit comments

Comments
 (0)