Code Duplication    Length = 8-8 lines in 2 locations

app/Models/Album.php 2 locations

@@ 126-133 (lines=8) @@
123
     * @param string $binaryData
124
     * @param string $extension  The file extension
125
     */
126
    public function writeCoverFile($binaryData, $extension)
127
    {
128
        $extension = trim(strtolower($extension), '. ');
129
        $destination = $this->generateRandomCoverPath($extension);
130
        file_put_contents($destination, $binaryData);
131
132
        $this->update(['cover' => basename($destination)]);
133
    }
134
135
    /**
136
     * Copy a cover file from an existing image on the system.
@@ 140-147 (lines=8) @@
137
     *
138
     * @param string $source The original image's full path.
139
     */
140
    public function copyCoverFile($source)
141
    {
142
        $extension = pathinfo($source, PATHINFO_EXTENSION);
143
        $destination = $this->generateRandomCoverPath($extension);
144
        copy($source, $destination);
145
146
        $this->update(['cover' => basename($destination)]);
147
    }
148
149
    /**
150
     * Generate a random path for the cover image.