Conditions | 2 |
Paths | 1 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
24 | public static function render($token, $isSandbox = false) |
||
25 | { |
||
26 | $template = |
||
27 | <<<'EOF' |
||
28 | <script> |
||
29 | var options = { |
||
30 | access_token: '%s', |
||
31 | sandbox: %s |
||
32 | }; |
||
33 | var s = document.createElement('script'); |
||
34 | s.type = "text/javascript"; |
||
35 | s.async = true; |
||
36 | s.src = "//static.xsolla.com/embed/paystation/1.0.7/widget.min.js"; |
||
37 | s.addEventListener('load', function (e) { |
||
38 | XPayStationWidget.init(options); |
||
39 | }, false); |
||
40 | var head = document.getElementsByTagName('head')[0]; |
||
41 | head.appendChild(s); |
||
42 | </script> |
||
43 | EOF; |
||
44 | |||
45 | return sprintf($template, $token, $isSandbox ? 'true' : 'false'); |
||
46 | } |
||
47 | } |
||
48 |