Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit
198 lines
4.7 KiB
PHP
Executable File
198 lines
4.7 KiB
PHP
Executable File
<?php
|
|
namespace XaiCorp\AbcParser\Domain\Core;
|
|
|
|
use Enzyme\Axiom\Atoms\StringAtom;
|
|
use Webpatser\Uuid\Uuid;
|
|
use XaiCorp\AbcParser\Domain\Atoms\EmailAtom;
|
|
use XaiCorp\AbcParser\Domain\Atoms\UnsignedIntegerAtom;
|
|
|
|
class TuneAttributeArrayBuilder implements TuneBuilder
|
|
{
|
|
protected $attributes = [];
|
|
|
|
protected $settingIndex = 0;
|
|
|
|
public static function create()
|
|
{
|
|
return new self();
|
|
}
|
|
|
|
/**
|
|
* @param \Webpatser\Uuid\Uuid|null $identity
|
|
* @return \XaiCorp\AbcParser\Domain\Core\Tune
|
|
*/
|
|
public function getTune(Uuid $identity = null): \XaiCorp\AbcParser\Domain\Core\Tune
|
|
{
|
|
return new Tune($this->attributes, $identity);
|
|
}
|
|
|
|
/**
|
|
* @return $this
|
|
*/
|
|
public function handleEndOfMusic()
|
|
{
|
|
$this->settingIndex++;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param UnsignedIntegerAtom $param
|
|
* @return $this
|
|
*/
|
|
public function setIndex(UnsignedIntegerAtom $param): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
|
|
{
|
|
$this->attributes['index'] = $param;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param string $param
|
|
* @return $this
|
|
*/
|
|
public function appendMusic(string $param): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
|
|
{
|
|
$index = 'MusicLines';
|
|
$item = $param;
|
|
|
|
if (!isset($this->attributes['settings'][$this->settingIndex][$index])) {
|
|
$this->attributes['settings'][$this->settingIndex][$index] = MultivalueAttribute::create($item);
|
|
} else {
|
|
$this->attributes['settings'][$this->settingIndex][$index]->add($item);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addTitle(string $title): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
|
|
{
|
|
$index = 'Titles';
|
|
$item = $title;
|
|
|
|
if (!isset($this->attributes[$index])) {
|
|
$this->attributes[$index] = MultivalueAttribute::create($item);
|
|
} else {
|
|
$this->attributes[$index]->add($item);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setKey(StringAtom $key)
|
|
{
|
|
// TODO: Implement setKey() method.
|
|
}
|
|
|
|
public function setMeter(StringAtom $key)
|
|
{
|
|
// TODO: Implement setMeter() method.
|
|
}
|
|
|
|
public function addAuthor(string $name): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
|
|
{
|
|
$index = 'Authors';
|
|
$item = Author::create($name, new EmailAtom(''));
|
|
|
|
if (!isset($this->attributes[$index])) {
|
|
$this->attributes[$index] = $item;
|
|
} else {
|
|
$this->attributes[$index]->add($item);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addComposer(string $name): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
|
|
{
|
|
$index = 'Composers';
|
|
$item = Composer::create($name, new EmailAtom(''));
|
|
|
|
if (!isset($this->attributes[$index])) {
|
|
$this->attributes[$index] = $item;
|
|
} else {
|
|
$this->attributes[$index]->add($item);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addTranscriber(StringAtom $transcriberName)
|
|
{
|
|
// TODO: Implement addTranscriber() method.
|
|
}
|
|
|
|
public function addDiscography(StringAtom $recording)
|
|
{
|
|
// TODO: Implement addDiscography() method.
|
|
}
|
|
|
|
public function addGroup(StringAtom $groupName)
|
|
{
|
|
// TODO: Implement addGroup() method.
|
|
}
|
|
|
|
public function setParts(StringAtom $part)
|
|
{
|
|
// TODO: Implement setParts() method.
|
|
}
|
|
|
|
public function addSource(StringAtom $source)
|
|
{
|
|
// TODO: Implement addSource() method.
|
|
}
|
|
|
|
public function addFilename(StringAtom $filename)
|
|
{
|
|
// TODO: Implement addFilename() method.
|
|
}
|
|
|
|
public function addHistory(string $history): \XaiCorp\AbcParser\Domain\Core\TuneBuilder
|
|
{
|
|
$index = 'HistoryLines';
|
|
$item = MultivalueAttribute::create($history);
|
|
|
|
if (!isset($this->attributes[$index])) {
|
|
$this->attributes[$index] = $item;
|
|
} else {
|
|
$this->attributes[$index]->add($item);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addRhythm(StringAtom $rhythm)
|
|
{
|
|
// TODO: Implement addRhythm() method.
|
|
}
|
|
|
|
public function addBook(StringAtom $param)
|
|
{
|
|
// TODO: Implement addBook() method.
|
|
}
|
|
|
|
public function addWords(StringAtom $param)
|
|
{
|
|
// TODO: Implement addWords() method.
|
|
}
|
|
|
|
public function addTempo(StringAtom $param)
|
|
{
|
|
// TODO: Implement addTempo() method.
|
|
}
|
|
|
|
public function addNoteLength(StringAtom $param)
|
|
{
|
|
// TODO: Implement addNoteLength() method.
|
|
}
|
|
|
|
public function addNote(StringAtom $param)
|
|
{
|
|
// TODO: Implement addNote() method.
|
|
}
|
|
|
|
public function addOrigin(StringAtom $param)
|
|
{
|
|
// TODO: Implement addOrigin() method.
|
|
}
|
|
}
|