/**
  * remove_reg_step
  * given a valid TXN_reg_step slug, this will remove (unset)
  * the reg step from the TXN reg step array
  *
  * @access public
  * @param \EE_Transaction $transaction
  * @param string $reg_step_slug
  * @return void
  */
 public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug)
 {
     // get reg steps array
     $txn_reg_steps = $transaction->reg_steps();
     unset($txn_reg_steps[$reg_step_slug]);
     $transaction->set_reg_steps($txn_reg_steps);
 }
 /**
  * set_reg_step_completed
  * given a valid reg step slug, this sets the TXN_reg_step completed status which is either:
  *
  *
  * @access private
  * @param \EE_Transaction $transaction
  * @param string          $reg_step_slug
  * @param boolean | int $status
  * @return boolean
  */
 private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status)
 {
     // validate status
     $status = is_bool($status) || is_numeric($status) ? $status : false;
     // get reg steps array
     $txn_reg_steps = $transaction->reg_steps();
     // if reg step does NOT exist
     if (!isset($txn_reg_steps[$reg_step_slug])) {
         return false;
     }
     // if  we're trying to complete a step that is already completed
     if ($txn_reg_steps[$reg_step_slug] === true) {
         return true;
     }
     // if  we're trying to complete a step that hasn't even started
     if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
         return false;
     }
     // if current status value matches the incoming value (no change)
     if ($txn_reg_steps[$reg_step_slug] === $status) {
         // this will happen in cases where multiple AJAX requests occur during the same step
         return true;
     }
     // if we're trying to set a start time
     if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
         // skip the update below, but don't return FALSE so that errors won't be displayed
         return true;
     }
     // update completed status
     $txn_reg_steps[$reg_step_slug] = $status;
     $transaction->set_reg_steps($txn_reg_steps);
     $transaction->save();
     // DEBUG LOG
     //$this->log(
     //	__CLASS__, __FUNCTION__, __LINE__,
     //	$transaction,
     //	array(
     //		'reg_step_slug' => $reg_step_slug,
     //		'status' => $status,
     //	)
     //);
     return true;
 }