Skip to content

Commit

Permalink
Merge branch 'release/v0.16.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Feb 18, 2025
2 parents 6641f61 + 1103249 commit b3673ab
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.16.1 (2025-02-18)
* Re-added ArrayAccess to ContentCollection

## v0.16.0 (2025-02-17)
* Upgraded PHPStan to v2
* Sorted out attribute value types
Expand Down
6 changes: 4 additions & 2 deletions src/Tagged/ContentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@

namespace DecodeLabs\Tagged;

use ArrayAccess;
use DecodeLabs\Collections\SequenceTrait;
use DecodeLabs\Collections\SequenceInterface;
use DecodeLabs\Elementary\Markup\ChildRendererTrait;

use IteratorAggregate;

/**
* @implements IteratorAggregate<mixed>
* @implements SequenceInterface<mixed>
* @implements ArrayAccess<int,mixed>
*/
class ContentCollection implements
Markup,
IteratorAggregate,
SequenceInterface
SequenceInterface,
ArrayAccess
{
/**
* @use SequenceTrait<mixed>
Expand Down
9 changes: 7 additions & 2 deletions src/Tagged/Embed/Audioboom.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ protected function lookupEmbedMeta(
'width' => $json['width'],
'height' => $json['height'],
'duration' => $json['duration'],
'uploadDate' => isset($json['upload_date']) ? (new DateTime())->setTimestamp((int)$json['upload_date']) : null,
'uploadDate' =>
isset($json['upload_date']) ?
new DateTime()->setTimestamp(
Coercion::toInt($json['upload_date'])
) :
null,
'description' => $json['description'],
'authorName' => $json['author_name'],
'authorUrl' => $json['author_url'],
Expand Down Expand Up @@ -245,7 +250,7 @@ protected function lookupPlaylistMeta(
$uploadTs = $uploadDate = $user = $profileUrl = null;

foreach ($playlist->memberships as $item) {
$duration += $item->audio_clip['duration'];
$duration += Coercion::toInt($item->audio_clip['duration']);
$currentDate = new DateTime(Coercion::toString($item->audio_clip['uploaded_at']));
$ts = $currentDate->getTimestamp();

Expand Down
6 changes: 5 additions & 1 deletion src/Tagged/Embed/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ public function lookupMeta(
'width' => $json['width'],
'height' => $json['height'],
'duration' => $json['duration'] ?? $json['length_seconds'],
'uploadDate' => isset($json['upload_date']) ? (new DateTime())->setTimestamp((int)$json['upload_date']) : null,
'uploadDate' => isset($json['upload_date']) ?
new DateTime()->setTimestamp(
Coercion::toInt($json['upload_date'])
) :
null,
'description' => $json['description'],
'authorName' => $json['author_name'],
'authorUrl' => $json['author_url'],
Expand Down
4 changes: 3 additions & 1 deletion src/Tagged/Embed/Youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ public function lookupMeta(
'height' => $json['height'],
'duration' => $info['length_seconds'],
'uploadDate' => isset($info['timestamp']) ?
new DateTime()->setTimestamp((int)$info['timestamp']) :
new DateTime()->setTimestamp(
Coercion::toInt($info['timestamp'])
) :
null,
'description' => $json['description'],
'authorName' => $json['author_name'],
Expand Down

0 comments on commit b3673ab

Please sign in to comment.