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

ResultItemFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 24
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A createPlaybackHistoryItem() 0 6 1
A createSongListItem() 0 8 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