private function getInvalidMetadata(FileUpload $song) : array { $invalidMetadata = []; $songReader = new \SongReader($song->getTemporaryFile()); if (!$songReader->getDuration()) { $invalidMetadata[] = 'playtime_string'; } if (!$songReader->getAuthor()) { $invalidMetadata[] = 'artist'; } if (!$songReader->getTitle()) { $invalidMetadata[] = 'title'; } if (!$songReader->getAlbum()) { $invalidMetadata[] = 'album'; } return $invalidMetadata; }
public function loadMetadata(\SongReader $songReader) { $songReader->getTitle() ? $this->title = $songReader->getTitle() : null; $songReader->getAuthor() ? $this->artist = $songReader->getAuthor() : null; $songReader->getDuration() ? $this->duration = $songReader->getDuration() : null; }