| Total Complexity | 3 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final readonly class SongDeleter implements SongDeleterInterface |
||
|
|
|||
| 12 | { |
||
| 13 | 1 | public function __construct( |
|
| 14 | private SongRepositoryInterface $songRepository, |
||
| 15 | private PlaybackHistoryRepositoryInterface $playbackHistoryRepository, |
||
| 16 | ) { |
||
| 17 | 1 | } |
|
| 18 | |||
| 19 | 1 | public function delete(SongInterface $song): void |
|
| 20 | { |
||
| 21 | 1 | $result = $this->playbackHistoryRepository->findBySong($song); |
|
| 22 | |||
| 23 | 1 | foreach ($result as $item) { |
|
| 24 | 1 | $this->playbackHistoryRepository->delete($item); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | $this->songRepository->delete($song); |
|
| 28 | } |
||
| 30 |