public function getBeatByStart($start) { $beatCount = $this->countBeats(); for ($i = 0; $i < $beatCount; $i++) { $beat = $this->getBeat($i); if ($beat->getStart() == $start) { return $beat; } } $beat = new Beat(); $beat->setStart($start); $this->addBeat($beat); return $beat; }
public function __clone() { $beat = new Beat(); $beat->setStart($this->getStart()); $beat->getStroke()->copyFrom($this->getStroke()); for ($i = 0; $i < count($this->voices); $i++) { $beat->setVoice($i, clone $this->voices[$i]); } if ($this->chord != null) { $beat->setChord(clone $this->chord); } if ($this->text != null) { $beat->setText(clone $this->text); } return $beat; }