referralProductLinkGenerator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace PTS\SyliusReferralPlugin\Extension;
5
6
use PTS\SyliusReferralPlugin\Service\ReferralManager;
7
use Twig\Extension\AbstractExtension;
8
9
class ReferralLinkExtension extends AbstractExtension
10
{
11
12
    /** @var ReferralManager */
13
    private $referralManager;
14
15
    /**
16
     * ReferralLinkExtension constructor.
17
     * @param ReferralManager $referralManager
18
     */
19
    public function __construct(ReferralManager $referralManager)
20
    {
21
        $this->referralManager = $referralManager;
22
    }
23
24
25
    public function getFunctions()
26
    {
27
        return [
28
            new \Twig_SimpleFunction('referralLink', [$this, 'referralProductLinkGenerator']),
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated: since Twig 2.7, use "Twig\TwigFunction" instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

28
            /** @scrutinizer ignore-deprecated */ new \Twig_SimpleFunction('referralLink', [$this, 'referralProductLinkGenerator']),
Loading history...
29
            new \Twig_SimpleFunction('referralRootLink', [$this, 'referralRootLinkGenerator'])
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated: since Twig 2.7, use "Twig\TwigFunction" instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

29
            /** @scrutinizer ignore-deprecated */ new \Twig_SimpleFunction('referralRootLink', [$this, 'referralRootLinkGenerator'])
Loading history...
30
        ];
31
    }
32
33
    public function referralProductLinkGenerator($id)
34
    {
35
        return $this->referralManager->referralProductLinkGenerator($id);
36
    }
37
38
    public function referralRootLinkGenerator()
39
    {
40
        return $this->referralManager->referralRootLinkGenerator();
41
    }
42
}
43