Passed
Push — main ( 98749a...e96c5f )
by Daniel
04:24
created

ResultItemFactory::createPlaybackHistoryItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Api\Lib;
6
7
use JsonSerializable;
8
use Uxmp\Core\Component\Config\ConfigProviderInterface;
9
use Uxmp\Core\Orm\Model\AlbumInterface;
10
use Uxmp\Core\Orm\Model\PlaybackHistoryInterface;
11
use Uxmp\Core\Orm\Model\SongInterface;
12
13
final class ResultItemFactory implements ResultItemFactoryInterface
14
{
15 2
    public function __construct(
16
        private ConfigProviderInterface $config
17
    ) {
18 2
    }
19
20 1
    public function createSongListItem(
21
        SongInterface $song,
22
        AlbumInterface $album
23
    ): JsonSerializable {
24 1
        return new SongListItem(
25 1
            $this->config,
26
            $song,
27
            $album,
28
        );
29
    }
30
31 1
    public function createPlaybackHistoryItem(
32
        PlaybackHistoryInterface $playbackHistory
33
    ): JsonSerializable {
34 1
        return new PlaybackHistoryItem(
35 1
            $this->config,
36
            $playbackHistory,
37
        );
38
    }
39
}
40