generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathId3TagAudioV1.php
35 lines (30 loc) · 1.03 KB
/
Id3TagAudioV1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace Kiwilan\Audio\Id3\Tag;
class Id3TagAudioV1 extends Id3Tag
{
public function __construct(
readonly public ?string $title = null,
readonly public ?string $artist = null,
readonly public ?string $album = null,
readonly public ?string $year = null,
readonly public ?string $genre = null,
readonly public ?string $comment = null,
readonly public ?string $track_number = null,
) {}
public static function make(?array $metadata): ?self
{
if (! $metadata) {
return null;
}
$self = new self(
title: self::parseTag($metadata, 'title'),
artist: self::parseTag($metadata, 'artist'),
album: self::parseTag($metadata, 'album'),
year: self::parseTag($metadata, 'year'),
genre: self::parseTag($metadata, 'genre'),
comment: self::parseTag($metadata, 'comment'),
track_number: self::parseTag($metadata, 'track_number'),
);
return $self;
}
}