Code Duplication    Length = 12-16 lines in 2 locations

src/TrackCollection.php 1 location

@@ 24-35 (lines=12) @@
21
        $this->tracks = $tracks;
22
    }
23
24
    private function assertThatTheseAreAllTracks(array $tracks)
25
    {
26
        foreach ($tracks as $track) {
27
            if (! ($track instanceof TrackInfo)) {
28
                throw new \InvalidArgumentException(sprintf(
29
                    'Expected "%s", but instead got: "%s"',
30
                    TrackInfo::class,
31
                    is_object($track) ? get_class($track) : gettype($track)
32
                ));
33
            }
34
        }
35
    }
36
37
    public function current()
38
    {

src/TrackInfo.php 1 location

@@ 32-47 (lines=16) @@
29
        }
30
    }
31
32
    private function assertThatTheseAreAllArtists(array $artists)
33
    {
34
        if (empty($artists)) {
35
            throw new InvalidArgumentException('A track should always have an artist');
36
        }
37
38
        foreach ($artists as $artist) {
39
            if (! ($artist instanceof Artist)) {
40
                throw new \InvalidArgumentException(sprintf(
41
                    'Expected "%s", but instead got: "%s"',
42
                    Artist::class,
43
                    is_object($artist) ? get_class($artist) : gettype($artist)
44
                ));
45
            }
46
        }
47
    }
48
49
    public function getName()
50
    {