collection = new TuneCollection(); $this->tune = new Tune([]); $this->setting = new Setting(); $this->tune->addSetting($this->setting); } public function __clone() { $this->collection = new TuneCollection(); $this->tune = new Tune([]); $this->setting = new Setting(); $this->tune->addSetting($this->setting); } public function getTune(Uuid $identity = null): \XaiCorp\AbcParser\Domain\Core\Tune { return $this->tune; } /** * @return \XaiCorp\AbcParser\Domain\Core\TuneCollection */ public function getCollection() { return $this->collection; } /** * @return TuneBuilder */ public function handleEndOfMusic() { if ($this->tune && empty($this->tune->getTitles())) { return $this; } $this->tune->addSetting($this->setting); $this->collection[] = $this->tune; $this->tune = new Tune([]); $this->setting = new Setting(); return $this; } /** * @param UnsignedIntegerAtom $param * @return TuneBuilder */ public function setIndex(UnsignedIntegerAtom $param): \XaiCorp\AbcParser\Domain\Core\TuneBuilder { $this->tune->setIndex($param); return $this; } public function appendMusic(StringAtom $param): \XaiCorp\AbcParser\Domain\Core\TuneBuilder { $this->setting->addMusicLine($param->getValue()); return $this; } public function addTitle(string $title): \XaiCorp\AbcParser\Domain\Core\TuneBuilder { $this->tune->addTitle($title); return $this; } public function setKey(StringAtom $key) { $this->setting->setKey($key->getValue()); return $this; } public function setMeter(StringAtom $key) { $this->setting->setMeter($key->getValue()); return $this; } public function addAuthor(string $name): \XaiCorp\AbcParser\Domain\Core\TuneBuilder { $author = Author::create($name, new EmailAtom('')); $this->tune->addAuthor($author); return $this; } public function addComposer(StringAtom $composerName) { $composer = new Composer($composerName, new EmailAtom('')); $this->tune->addComposer($composer); return $this; } public function addTranscriber(StringAtom $transcriberName) { $transcriber = new Transcriber($transcriberName, new EmailAtom('')); $this->setting->addTranscriber($transcriber); return $this; } public function addDiscography(StringAtom $recording) { $this->setting->addRecording($recording->getValue()); return $this; } public function addGroup(StringAtom $groupName) { $this->tune->addGroup($groupName->getValue()); } public function setParts(StringAtom $part) { $this->setting->setPart($part->getValue()); } public function addSource(StringAtom $source) { $this->setting->addSource($source->getValue()); } public function addFilename(StringAtom $filename) { $this->setting->addFilename($filename->getValue()); } public function addHistory(StringAtom $history) { $this->tune->addHistoryLine($history->getValue()); } public function addRhythm(StringAtom $rhythm) { $this->tune->addRhythm($rhythm->getValue()); } public function addBook(StringAtom $param) { $this->setting->addBook($param->getValue()); } public function addWords(StringAtom $param) { $this->setting->addWords($param->getValue()); } public function addTempo(StringAtom $param) { $this->setting->setTempo($param->getValue()); } public function addNoteLength(StringAtom $param) { $this->setting->setNoteLength($param->getValue()); } public function addNote(StringAtom $param) { $this->setting->addNote($param->getValue()); } public function addOrigin(StringAtom $param) { $this->tune->addOrigin($param->getValue()); } }