Пример #1
0
 /**
  * @inheritDoc
  */
 public function handleLoanAmount(LoanApplicationRequest $loanRequest) : LoanApplicationResponse
 {
     if ($loanRequest->getAmount() < 20000) {
         return $this->approveLoanRequest();
     }
     return $this->rejectLoanRequest();
 }
Пример #2
0
 /**
  * @inheritDoc
  */
 public function handleLoanAmount(LoanApplicationRequest $loanRequest) : LoanApplicationResponse
 {
     if ($loanRequest->getAmount() < 5000) {
         return $this->approveLoanRequest();
     }
     return $this->getNextInChain()->handleLoanAmount($loanRequest);
 }
Пример #3
0
 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;
 }