public function copyFrom(\FutoIn\AsyncSteps $other) { if (!$other instanceof \FutoIn\RI\AsyncSteps) { throw new \FutoIn\Error(\FutoIn\Error::InternalError); } $this->_sanityCheck(); // Copy steps $oq = $other->_getInnerQueue(); $oq->rewind(); if ($oq->valid()) { $q = $this->_queue; if (!$q) { $q = new \SplQueue(); $this->_queue = $q; } for (; $oq->valid(); $oq->next()) { $q->enqueue($oq->current()); } } // Copy state $s = $this->state(); foreach ($other->state() as $k => $v) { if (!isset($s->{$k})) { $s->{$k} = $v; } } }