AbstractTransactionRequest::getParameters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Nexylan packages.
5
 *
6
 * (c) Nexylan SAS <[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 Nexy\PayboxDirect\Request;
13
14
use Greg0ire\Enum\Bridge\Symfony\Validator\Constraint\Enum;
15
use Symfony\Component\Validator\Constraints as Assert;
16
17
/**
18
 * @author Sullivan Senechal <[email protected]>
19
 */
20
abstract class AbstractTransactionRequest extends AbstractRequest
21
{
22
    /**
23
     * @var int
24
     *
25
     * @Assert\Type("int")
26
     */
27
    private $amount;
28
29
    /**
30
     * @var int|null
31
     *
32
     * @Enum(class="Nexy\PayboxDirect\Enum\Currency", showKeys=true)
33
     */
34
    private $currency = null;
35
36
    /**
37
     * @param int         $amount
38
     * @param string|null $subscriberRef
39
     */
40
    public function __construct($amount, $subscriberRef = null)
41
    {
42
        parent::__construct($subscriberRef);
43
44
        $this->amount = $amount;
45
    }
46
47
    /**
48
     * @param int $currency
49
     *
50
     * @return $this
51
     */
52
    final public function setCurrency($currency = null)
53
    {
54
        $this->currency = $currency;
55
56
        return $this;
57
    }
58
59
    public function getParameters()
60
    {
61
        $parameters = [
62
            'MONTANT' => $this->amount,
63
            'DEVISE' => $this->currency,
64
        ];
65
66
        return array_merge(parent::getParameters(), $parameters);
67
    }
68
}
69