/** * Copy steps from other AsyncSteps, useful for sub-step cloning * * @param \FutoIn\RI\AsyncSteps $other model AsyncSteps object for re-use * @return \FutoIn\AsyncSteps reference to $this */ public function copyFrom(\FutoIn\AsyncSteps $other) { if (!$other instanceof \FutoIn\RI\AsyncSteps) { throw new \FutoIn\Error(\FutoIn\Error::InternalError); } // Copy steps $oq = $other->_getInnerQueue(); $oq->rewind(); $q = $this->queue; 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; } } }