normal($this->argument('paymentMethod')); $result = $this->strategy($this->argument('paymentMethod')); $this->line($result); } private function strategy($paymentMethod){ $payment = new PaymentContextService($paymentMethod); return $payment->pay(); } /** * normal * * @param mixed $paymentMethod * @return string */ private function normal($paymentMethod){ if('credit' == $paymentMethod){ return 'CreditCard'; } if('google' == $paymentMethod){ return 'GooglePay'; } if('apple' == $paymentMethod){ return 'ApplePay'; } throw new \InvalidArgumentException("You must pass in either credit, apple or google as the payment method."); } }