Skip to content

Commit

Permalink
Update codestyle in PodcastIndex extension
Browse files Browse the repository at this point in the history
  • Loading branch information
codedmonkey committed Dec 11, 2020
1 parent 662904f commit 1878720
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/Reader/Extension/PodcastIndex/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public function getSoundbites()
*/
protected function registerNamespaces()
{
$this->xpath->registerNamespace('podcast', 'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md');
$this->xpath->registerNamespace(
'podcast',
'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md'
);
}
}
5 changes: 4 additions & 1 deletion src/Reader/Extension/PodcastIndex/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public function getFunding()
*/
protected function registerNamespaces()
{
$this->xpath->registerNamespace('podcast', 'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md');
$this->xpath->registerNamespace(
'podcast',
'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md'
);
}
}
18 changes: 14 additions & 4 deletions src/Writer/Extension/PodcastIndex/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ public function getEncoding()
/**
* Set entry transcript
*
* @param array $value
* @return $this
* @throws Writer\Exception\InvalidArgumentException
*/
public function setPodcastIndexTranscript(array $value)
{
if (! isset($value['url']) || ! isset($value['type'])) {
throw new Writer\Exception\InvalidArgumentException(
'invalid parameter: "chapters" must be an array containing keys "url" and "type" and optionally "language" and "rel"'
'invalid parameter: "chapters" must be an array containing keys'
. ' "url" and "type" and optionally "language" and "rel"'
);
}
$this->data['transcript'] = $value;
Expand All @@ -83,6 +85,7 @@ public function setPodcastIndexTranscript(array $value)
/**
* Set entry chapters
*
* @param array $value
* @return $this
* @throws Writer\Exception\InvalidArgumentException
*/
Expand All @@ -100,6 +103,7 @@ public function setPodcastIndexChapters(array $value)
/**
* Add entry soundbites
*
* @param array $values
* @return $this
* @throws Writer\Exception\InvalidArgumentException
*/
Expand All @@ -115,22 +119,28 @@ public function addPodcastIndexSoundbites(array $values)
/**
* Add entry soundbite
*
* @param array $value
* @return $this
* @throws Writer\Exception\InvalidArgumentException
*/
public function addPodcastIndexSoundbite(array $value)
{
if (! isset($value['startTime']) || ! isset($value['duration'])) {
throw new Writer\Exception\InvalidArgumentException(
'invalid parameter: any "soundbite" must be an array containing keys "startTime" and "duration" and optionally "title"'
'invalid parameter: any "soundbite" must be an array containing'
. ' keys "startTime" and "duration" and optionally "title"'
);
}
if (! is_numeric($value['startTime']) && strlen($value['startTime']) > 0) {
if ((! is_string($value['startTime']) || ! is_numeric($value['startTime']))
&& strlen($value['startTime']) > 0
) {
throw new Writer\Exception\InvalidArgumentException(
'invalid parameter: "startTime" of "soundbite" may only contain numeric characters and dots'
);
}
if (! is_numeric($value['duration']) && strlen($value['duration']) > 0) {
if ((! is_string($value['duration']) || ! is_numeric($value['duration']))
&& strlen($value['duration']) > 0
) {
throw new Writer\Exception\InvalidArgumentException(
'invalid parameter: "duration" may only contain numeric characters and dots'
);
Expand Down
6 changes: 3 additions & 3 deletions src/Writer/Extension/PodcastIndex/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ public function getEncoding()
/**
* Set a locked value of "yes" or "no" with an "owner" field.
*
* @param string
*
* @param array $value
* @return $this
* @throws Writer\Exception\InvalidArgumentException
*/
public function setPodcastIndexLocked($value)
public function setPodcastIndexLocked(array $value)
{
if (! isset($value['value']) || ! isset($value['owner'])) {
throw new Writer\Exception\InvalidArgumentException(
Expand All @@ -90,6 +89,7 @@ public function setPodcastIndexLocked($value)
/**
* Set feed funding
*
* @param array $value
* @return $this
* @throws Writer\Exception\InvalidArgumentException
*/
Expand Down

0 comments on commit 1878720

Please sign in to comment.