Code Duplication    Length = 26-28 lines in 2 locations

src/Bridge/Ecpay/Sdk/ECPay.Payment.Integration.php 2 locations

@@ 542-569 (lines=28) @@
539
    //付款方式物件
540
    public static $PaymentObj;
541
542
    public static function CheckOut($target = '_self', $arParameters = [], $arExtend = [], $HashKey = '', $HashIV = '', $ServiceURL = '')
543
    {
544
        $arParameters = self::process($arParameters, $arExtend);
545
        //產生檢查碼
546
        $szCheckMacValue = ECPay_CheckMacValue::generate($arParameters, $HashKey, $HashIV, $arParameters['EncryptType']);
547
548
        //生成表單,自動送出
549
        $szHtml = '<!DOCTYPE html>';
550
        $szHtml .= '<html>';
551
        $szHtml .= '<head>';
552
        $szHtml .= '<meta charset="utf-8">';
553
        $szHtml .= '</head>';
554
        $szHtml .= '<body>';
555
        $szHtml .= "<form id=\"__ecpayForm\" method=\"post\" target=\"{$target}\" action=\"{$ServiceURL}\">";
556
557
        foreach ($arParameters as $keys => $value) {
558
            $szHtml .= "<input type=\"hidden\" name=\"{$keys}\" value='{$value}' />";
559
        }
560
561
        $szHtml .= "<input type=\"hidden\" name=\"CheckMacValue\" value=\"{$szCheckMacValue}\" />";
562
        $szHtml .= '</form>';
563
        $szHtml .= '<script type="text/javascript">document.getElementById("__ecpayForm").submit();</script>';
564
        $szHtml .= '</body>';
565
        $szHtml .= '</html>';
566
567
        echo $szHtml;
568
        exit;
569
    }
570
571
    public static function CheckOutString($paymentButton, $target = '_self', $arParameters = [], $arExtend = [], $HashKey = '', $HashIV = '', $ServiceURL = '')
572
    {
@@ 571-596 (lines=26) @@
568
        exit;
569
    }
570
571
    public static function CheckOutString($paymentButton, $target = '_self', $arParameters = [], $arExtend = [], $HashKey = '', $HashIV = '', $ServiceURL = '')
572
    {
573
        $arParameters = self::process($arParameters, $arExtend);
574
        //產生檢查碼
575
        $szCheckMacValue = ECPay_CheckMacValue::generate($arParameters, $HashKey, $HashIV, $arParameters['EncryptType']);
576
577
        $szHtml = '<!DOCTYPE html>';
578
        $szHtml .= '<html>';
579
        $szHtml .= '<head>';
580
        $szHtml .= '<meta charset="utf-8">';
581
        $szHtml .= '</head>';
582
        $szHtml .= '<body>';
583
        $szHtml .= "<form id=\"__ecpayForm\" method=\"post\" target=\"{$target}\" action=\"{$ServiceURL}\">";
584
585
        foreach ($arParameters as $keys => $value) {
586
            $szHtml .= "<input type=\"hidden\" name=\"{$keys}\" value='{$value}' />";
587
        }
588
589
        $szHtml .= "<input type=\"hidden\" name=\"CheckMacValue\" value=\"{$szCheckMacValue}\" />";
590
        $szHtml .= "<input type=\"submit\" id=\"__paymentButton\" value=\"{$paymentButton}\" />";
591
        $szHtml .= '</form>';
592
        $szHtml .= '</body>';
593
        $szHtml .= '</html>';
594
595
        return  $szHtml;
596
    }
597
598
    protected static function process($arParameters = [], $arExtend = [])
599
    {