/** * Get previous transfer screen step by current step * * @param string $currentStep * @return string * @throws \InvalidArgumentException */ public function getPreviousStep($currentStep) { switch ($currentStep) { case ClientAccount::STEP_ACTION_CREDENTIALS: $prevStep = ''; break; case ClientAccount::STEP_ACTION_FINISHED: $prevStep = ClientAccount::STEP_ACTION_CREDENTIALS; break; default: throw new \InvalidArgumentException(sprintf('Invalid value of step: "%s" for account with system_type: "%s"', $this->account->getSystemTypeAsString(), $currentStep)); break; } return $prevStep; }
/** * Get previous transfer screen step by current step * * @param string $currentStep * @return string * @throws \InvalidArgumentException */ public function getPreviousStep($currentStep) { switch ($currentStep) { case ClientAccount::STEP_ACTION_BASIC: $prevStep = ''; break; case ClientAccount::STEP_ACTION_PERSONAL: $prevStep = ClientAccount::STEP_ACTION_BASIC; break; case ClientAccount::STEP_ACTION_BENEFICIARIES: $prevStep = ClientAccount::STEP_ACTION_PERSONAL; break; case ClientAccount::STEP_ACTION_TRANSFER: $prevStep = ClientAccount::STEP_ACTION_BENEFICIARIES; break; case ClientAccount::STEP_ACTION_ROLLOVER: if ($this->account->hasGroup(AccountGroup::GROUP_FINANCIAL_INSTITUTION)) { $prevStep = ClientAccount::STEP_ACTION_TRANSFER; } else { $prevStep = ClientAccount::STEP_ACTION_BENEFICIARIES; } break; case ClientAccount::STEP_ACTION_FUNDING_DISTRIBUTING: if ($this->account->hasGroup(AccountGroup::GROUP_OLD_EMPLOYER_RETIREMENT)) { $prevStep = ClientAccount::STEP_ACTION_ROLLOVER; } elseif ($this->account->hasGroup(AccountGroup::GROUP_FINANCIAL_INSTITUTION)) { $prevStep = ClientAccount::STEP_ACTION_TRANSFER; } else { $prevStep = ClientAccount::STEP_ACTION_BENEFICIARIES; } break; case ClientAccount::STEP_ACTION_REVIEW: if ($this->hasFundingSection()) { $prevStep = ClientAccount::STEP_ACTION_FUNDING_DISTRIBUTING; } elseif ($this->account->hasGroup(AccountGroup::GROUP_OLD_EMPLOYER_RETIREMENT)) { $prevStep = ClientAccount::STEP_ACTION_ROLLOVER; } elseif ($this->account->hasGroup(AccountGroup::GROUP_FINANCIAL_INSTITUTION)) { $prevStep = ClientAccount::STEP_ACTION_TRANSFER; } else { $prevStep = ClientAccount::STEP_ACTION_BENEFICIARIES; } break; case ClientAccount::STEP_ACTION_FINISHED: $prevStep = ClientAccount::STEP_ACTION_REVIEW; break; default: throw new \InvalidArgumentException(sprintf('Invalid value of step: "%s" for account with system_type: "%s"', $this->account->getSystemTypeAsString(), $currentStep)); break; } return $prevStep; }