add authors, composers, history and settings to Tune::merge()

This commit is contained in:
2018-05-10 21:34:53 -04:00
parent 82dc3de079
commit d4d3654653
12 changed files with 640 additions and 28 deletions

View File

@@ -94,9 +94,9 @@ class Builder implements TuneBuilder
return $this;
}
public function appendMusic(StringAtom $param): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
public function appendMusic(string $param): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
{
$this->setting->addMusicLine($param->getValue());
$this->setting->addMusicLine($param);
return $this;
}
@@ -130,9 +130,9 @@ class Builder implements TuneBuilder
return $this;
}
public function addComposer(StringAtom $composerName)
public function addComposer(string $name): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
{
$composer = new Composer($composerName, new EmailAtom(''));
$composer = Composer::create($name, new EmailAtom(''));
$this->tune->addComposer($composer);
return $this;
@@ -173,9 +173,11 @@ class Builder implements TuneBuilder
$this->setting->addFilename($filename->getValue());
}
public function addHistory(StringAtom $history)
public function addHistory(string $history): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
{
$this->tune->addHistoryLine($history->getValue());
$this->tune->addHistoryLine($history);
return $this;
}
public function addRhythm(StringAtom $rhythm)

View File

@@ -33,7 +33,7 @@ class Composer implements Lex
list($key, $data) = $this->getKeyDataFromLine($line);
if ($key === 'C') {
$this->builder->addComposer(new StringAtom($data));
$this->builder->addComposer($data);
}
return $next($context);

View File

@@ -36,10 +36,10 @@ class History implements Lex
if ($key === 'H'
&& $context->isState($context::MODE_TUNE_HEADER)
) {
$this->builder->addHistory(new StringAtom($data));
$this->builder->addHistory($data);
$context->setStateInHistory();
} elseif ($context->isState($context::MODE_HISTORY)) {
$this->builder->addHistory(new StringAtom($line));
$this->builder->addHistory($line);
if ($this->nextLineNotHistory($context)) {
$context->setStateInTuneHeader();

View File

@@ -36,7 +36,7 @@ class MusicLine implements Lex
&& $key !== 'K'
&& $line !== ''
) {
$this->builder->appendMusic(new StringAtom($line));
$this->builder->appendMusic($line);
}
return $next($context);