Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
15 | public function buildRequestForm(string $gateway, array $payload) : string |
||
16 | { |
||
17 | $format |
||
18 | = <<<HTML |
||
19 | <form id="alipaysubmit" name="alipaysubmit" action="%s" method="post"> |
||
20 | %s |
||
21 | <input type="submit" value="ok" style="display: none"> |
||
22 | <script>document.forms['alipaysubmit'].submit()</script> |
||
23 | </form> |
||
24 | HTML; |
||
25 | $input = ''; |
||
26 | foreach ($payload as $key => $val) { |
||
27 | $val = str_replace("'", ''', $val); |
||
28 | $input .= "<input type='hidden' name='{$key}' value='{$val}'>"; |
||
29 | } |
||
30 | $html = sprintf($format, $gateway, $input); |
||
31 | |||
32 | return $html; |
||
33 | } |
||
35 |