Passed
Push — master ( ca91ee...f1c38a )
by Florian
04:54 queued 02:49
created

BasePayrexxService::getPayrexx()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the vseth-musikzimmer-pay project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Service\Payment;
13
14
use App\Service\Payment\Interfaces\PaymentProviderServiceInterface;
15
use Payrexx\Payrexx;
16
use Payrexx\PayrexxException;
17
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
18
use Symfony\Contracts\Translation\TranslatorInterface;
19
20
abstract class BasePayrexxService implements PaymentProviderServiceInterface
21
{
22
    /**
23
     * @var string
24
     */
25
    private $payrexxInstanceName;
26
27
    /**
28
     * @var string
29
     */
30
    private $payrexxSecret;
31
32
    /**
33
     * @var int
34
     */
35
    private $payrexxPsp;
36
37
    /**
38
     * @var TranslatorInterface
39
     */
40
    private $translator;
41
42
    public function __construct(ParameterBagInterface $parameterBag, TranslatorInterface $translator)
43
    {
44
        $this->payrexxInstanceName = $parameterBag->get('PAYREXX_INSTANCE');
45
        $this->payrexxSecret = $parameterBag->get('PAYREXX_SECRET');
46
        $this->payrexxPsp = (int)$parameterBag->get('PAYREXX_PSP');
47
48
        $this->translator = $translator;
49
    }
50
51
    /**
52
     * @throws PayrexxException
53
     *
54
     * @return Payrexx
55
     */
56
    protected function getPayrexx()
57
    {
58
        return new Payrexx($this->payrexxInstanceName, $this->payrexxSecret);
59
    }
60
61
    protected function getTranslator(): TranslatorInterface
62
    {
63
        return $this->translator;
64
    }
65
66
    /**
67
     * @return TranslatorInterface
68
     */
69
    protected function getPayrexxPsp(): int
70
    {
71
        return $this->payrexxPsp;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->payrexxPsp returns the type integer which is incompatible with the documented return type Symfony\Contracts\Translation\TranslatorInterface.
Loading history...
72
    }
73
}
74