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; }