Total Complexity | 4 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | class CoinhiveMinerExtension extends \Twig_Extension |
||
11 | { |
||
12 | /** |
||
13 | * @var |
||
14 | */ |
||
15 | private $siteKey; |
||
16 | |||
17 | /** |
||
18 | * WidgetExtension constructor. |
||
19 | * @param $siteKey |
||
20 | * @internal param $key |
||
21 | */ |
||
22 | public function __construct( |
||
23 | $siteKey |
||
24 | ) |
||
25 | { |
||
26 | |||
27 | $this->siteKey = $siteKey; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @return array |
||
32 | */ |
||
33 | public function getFunctions() |
||
34 | { |
||
35 | return array( |
||
36 | new \Twig_SimpleFunction('coinhive_miner', [$this, 'coinhiveMiner'], [ |
||
37 | 'is_safe' => ['html'], |
||
38 | 'needs_environment' => true, |
||
39 | ]), |
||
40 | ); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param Twig_Environment $env |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function coinhiveMiner(Twig_Environment $env) |
||
53 | ] |
||
54 | ); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getName() |
||
63 | } |
||
64 | } |
||
65 |