generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathId3TagAsf.php
40 lines (36 loc) · 1.39 KB
/
Id3TagAsf.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
36
37
38
39
40
<?php
namespace Kiwilan\Audio\Id3\Tag;
class Id3TagAsf extends Id3Tag
{
public function __construct(
readonly public ?string $title = null,
readonly public ?string $artist = null,
readonly public ?string $album = null,
readonly public ?string $albumartist = null,
readonly public ?string $composer = null,
readonly public ?string $partofset = null,
readonly public ?string $genre = null,
readonly public ?string $track_number = null,
readonly public ?string $year = null,
readonly public ?string $encodingsettings = 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'),
albumartist: self::parseTag($metadata, 'albumartist'),
composer: self::parseTag($metadata, 'composer'),
partofset: self::parseTag($metadata, 'partofset'),
genre: self::parseTag($metadata, 'genre'),
track_number: self::parseTag($metadata, 'track_number'),
year: self::parseTag($metadata, 'year'),
encodingsettings: self::parseTag($metadata, 'encodingsettings'),
);
return $self;
}
}