4 changed files with 51 additions and 53 deletions
@ -1,41 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
namespace App\Dataclasses; |
|
||||
|
|
||||
class TuneVariant |
|
||||
{ |
|
||||
private DatabaseFolkTuneDetails $Tune; |
|
||||
public string $ID; |
|
||||
public array $Parts; |
|
||||
|
|
||||
public function __construct(DatabaseFolkTuneDetails $tuneDetails, array $assocArray) |
|
||||
{ |
|
||||
$this->ID = $assocArray['ID']; |
|
||||
$this->Tune = $tuneDetails; |
|
||||
|
|
||||
$temp = json_decode($assocArray['Parts'], associative: true, flags: JSON_THROW_ON_ERROR); |
|
||||
foreach($temp as $part) |
|
||||
$this->Parts[] = new TuneVariantPart($part); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public function Build(): string |
|
||||
{ |
|
||||
$builder = "X: {$this->Tune->ID}.{$this->ID} |
|
||||
T: {$this->Tune->Title} |
|
||||
S: {$this->Tune->Copyright} |
|
||||
M: {$this->Parts[0]->TimeSignature} |
|
||||
K: {$this->Parts[0]->KeySignature} |
|
||||
L: 1/8"; |
|
||||
$counter = 0; |
|
||||
$letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']; |
|
||||
foreach($this->Parts as $part) |
|
||||
{ |
|
||||
$builder .= " |
|
||||
P: {$letters[$counter]} Part |
|
||||
{$part->ABCNotation}"; |
|
||||
$counter = $counter + 1; |
|
||||
} |
|
||||
return $builder; |
|
||||
} |
|
||||
} |
|
Loading…
Reference in new issue