diff --git a/App/Dataclasses/ABCWrapper.php b/App/Dataclasses/ABCWrapper.php new file mode 100644 index 0000000..5b600aa --- /dev/null +++ b/App/Dataclasses/ABCWrapper.php @@ -0,0 +1,50 @@ +ID = $assocArray['ID']; + $this->Title = $assocArray['Title']; + $this->Source = $assocArray['Copyright']; + $this->TimeSignature = $assocArray['TimeSignature']; + $this->KeySignature = $assocArray['KeySignature']; + $this->Parts = json_decode($assocArray['Parts'], true); + } + + + public function Build(): string + { + $builder = "X: {$this->ID} +T: {$this->Title} +S: {$this->Source} +M: {$this->TimeSignature} +K: {$this->KeySignature} +L: {$this->DefaultNoteLength}"; + $counter = 0; + $letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']; + foreach($this->Parts as $part) + { + $builder .= " +P: {$letters[$counter]} Part +{$part}"; + $counter = $counter + 1; + } + return $builder; + } +} \ No newline at end of file