/** * @inheritDoc */ public function handleLoanAmount(LoanApplicationRequest $loanRequest) : LoanApplicationResponse { if ($loanRequest->getAmount() < 20000) { return $this->approveLoanRequest(); } return $this->rejectLoanRequest(); }
/** * @inheritDoc */ public function handleLoanAmount(LoanApplicationRequest $loanRequest) : LoanApplicationResponse { if ($loanRequest->getAmount() < 5000) { return $this->approveLoanRequest(); } return $this->getNextInChain()->handleLoanAmount($loanRequest); }
public static function generateStory(LoanApplicationRequest $request, LoanApplicationResponse $response) : string { $approvedStatus = $response->isApproved() ? 'approved' : 'not approved'; $story = "--- The story of {$request->getCustomer()} ---" . PHP_EOL; $story .= "The bank customer {$request->getCustomer()} has applied for a loan of {$request->getAmount()}." . PHP_EOL; $story .= "The bank has {$approvedStatus} the request, and the form has been processed by a {$response->getAgent()}." . PHP_EOL . PHP_EOL; return $story; }