ExchangeEnquiry::getBaseCurrency()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace App\Entity;
6
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
class ExchangeEnquiry
10
{
11
    /**
12
     * @Assert\NotBlank
13
     * @Assert\GreaterThan(0)
14
     *
15
     * @var float Amount to exchange
16
     */
17
    protected $amount;
18
19
    /**
20
     * @Assert\NotBlank
21
     * @Assert\Currency
22
     *
23
     * @var string ISO 4217 Currency Code of base currency
24
     */
25
    protected $baseCurrency;
26
27
    /**
28
     * @Assert\NotBlank
29
     * @Assert\Currency
30
     *
31
     * @var string ISO 4217 Currency Code of target currency
32
     */
33
    protected $targetCurrency;
34
35
    /**
36
     * ExchangeEnquiry constructor.
37
     *
38
     * @param float|null  $amount         Amount to exchange
39
     * @param string|null $baseCurrency   ISO 4217 Currency Code of base currency
40
     * @param string|null $targetCurrency ISO 4217 Currency Code of target currency
41
     */
42
    public function __construct(float $amount = null, string $baseCurrency = null, string $targetCurrency = null)
43
    {
44
        $this->amount         = $amount ? $amount : 0.0;
45
        $this->baseCurrency   = $baseCurrency ? $baseCurrency : '';
46
        $this->targetCurrency = $targetCurrency ? $targetCurrency : '';
47
    }
48
49
    /**
50
     * @param float $amount
51
     */
52
    public function setAmount(float $amount): void
53
    {
54
        $this->amount = $amount;
55
    }
56
57
    /**
58
     * @param string $baseCurrency
59
     */
60
    public function setBaseCurrency(string $baseCurrency): void
61
    {
62
        $this->baseCurrency = $baseCurrency;
63
    }
64
65
    /**
66
     * @param string $targetCurrency
67
     */
68
    public function setTargetCurrency(string $targetCurrency): void
69
    {
70
        $this->targetCurrency = $targetCurrency;
71
    }
72
73
    /**
74
     * @return float
75
     */
76
    public function getAmount(): float
77
    {
78
        return $this->amount;
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    public function getBaseCurrency(): string
85
    {
86
        return $this->baseCurrency;
87
    }
88
89
    /**
90
     * @return string
91
     */
92
    public function getTargetCurrency(): string
93
    {
94
        return $this->targetCurrency;
95
    }
96
}
97