From cec4fa17d2668aba357158dab6d9df80b834860c Mon Sep 17 00:00:00 2001 From: Cerys Date: Sat, 25 Jan 2025 11:16:05 +0000 Subject: [PATCH] " --- App/Dataclasses/ABCWrapper.php | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 App/Dataclasses/ABCWrapper.php 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