finished default parser
This commit is contained in:
313
src/Domain/Core/Setting.php
Normal file
313
src/Domain/Core/Setting.php
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
namespace XaiCorp\AbcParser\Domain\Core;
|
||||
|
||||
|
||||
use Enzyme\Axiom\Atoms\StringAtom;
|
||||
|
||||
class Setting
|
||||
{
|
||||
use IdentityTrait;
|
||||
|
||||
//fields that support multiple values
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $transcribers = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $notes = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $discography = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $sources = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $words = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $books = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $filenames = [];
|
||||
|
||||
//fields that only ever have one value
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $part = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tempo = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $noteLength = '1/8';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $meter = '4/4';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $key = 'C';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $music = [];
|
||||
|
||||
/**
|
||||
* @return \XaiCorp\AbcParser\Domain\Core\Transcriber[]
|
||||
*/
|
||||
public function getTranscribers(): array
|
||||
{
|
||||
return $this->transcribers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Transcriber $transcriber
|
||||
* @return Setting
|
||||
*/
|
||||
public function addTranscriber(Transcriber $transcriber): Setting
|
||||
{
|
||||
$this->transcribers[] = $transcriber;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNotes(): array
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $note
|
||||
* @return Setting
|
||||
*/
|
||||
public function addNote(string $note): Setting
|
||||
{
|
||||
$this->notes[] = $note;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDiscography(): array
|
||||
{
|
||||
return $this->discography;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $recording
|
||||
* @return Setting
|
||||
*/
|
||||
public function addRecording(string $recording): Setting
|
||||
{
|
||||
$this->discography[] = $recording;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSources(): array
|
||||
{
|
||||
return $this->sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $source
|
||||
* @return Setting
|
||||
*/
|
||||
public function addSource(string $source): Setting
|
||||
{
|
||||
$this->sources[] = $source;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getWords(): array
|
||||
{
|
||||
return $this->words;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $words
|
||||
* @return Setting
|
||||
*/
|
||||
public function addWords(string $words): Setting
|
||||
{
|
||||
$this->words[] = $words;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getBooks(): array
|
||||
{
|
||||
return $this->books;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $book
|
||||
* @return Setting
|
||||
*/
|
||||
public function addBook(string $book): Setting
|
||||
{
|
||||
$this->books[] = $book;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getFilenames(): array
|
||||
{
|
||||
return $this->filenames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @return Setting
|
||||
*/
|
||||
public function addFilename(string $filename): Setting
|
||||
{
|
||||
$this->filenames[] = $filename;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPart(): string
|
||||
{
|
||||
return $this->part;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $part
|
||||
* @return Setting
|
||||
*/
|
||||
public function setPart(string $part): Setting
|
||||
{
|
||||
$this->part = $part;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTempo(): string
|
||||
{
|
||||
return $this->tempo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tempo
|
||||
* @return Setting
|
||||
*/
|
||||
public function setTempo(string $tempo): Setting
|
||||
{
|
||||
$this->tempo = $tempo;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNoteLength(): string
|
||||
{
|
||||
return $this->noteLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $noteLength
|
||||
* @return Setting
|
||||
*/
|
||||
public function setNoteLength(string $noteLength): Setting
|
||||
{
|
||||
$this->noteLength = $noteLength;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMeter(): string
|
||||
{
|
||||
return $this->meter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $meter
|
||||
* @return Setting
|
||||
*/
|
||||
public function setMeter(string $meter): Setting
|
||||
{
|
||||
$this->meter = $meter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return Setting
|
||||
*/
|
||||
public function setKey(string $key): Setting
|
||||
{
|
||||
$this->key = $key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMusic(): string
|
||||
{
|
||||
return implode('\n', $this->music);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $music
|
||||
* @return Setting
|
||||
*/
|
||||
public function addMusicLine(string $music): Setting
|
||||
{
|
||||
$this->music[] = $music;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user