AbstractCurrency   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 16
dl 0
loc 69
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getDecimalSeparator() 0 3 1
A getCode() 0 3 1
A getThousandsSeparator() 0 3 1
A getSymbolPosition() 0 3 1
A getSymbol() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Whallysson\Money\Currency;
6
7
/**
8
 * Class AbstractCurrency
9
 *
10
 * @author Whallysson Avelino <[email protected]>
11
 * @package Whallysson\Money\Currency
12
 */
13
class AbstractCurrency implements CurrencyInterface
14
{
15
    /** @var string */
16
    protected string $code;
17
18
    /** @var string */
19
    protected string $symbol;
20
21
    /** @var string */
22
    protected string $decimalSeparator;
23
24
    /** @var string */
25
    protected string $thousandsSeparator;
26
27
    /** @var string */
28
    protected string $symbolPosition;
29
30
    public function __construct(
31
        string $code,
32
        string $symbol,
33
        string $decimalSeparator,
34
        string $thousandsSeparator,
35
        string $symbolPosition = 'before'
36
    ) {
37
        $this->code = $code;
38
        $this->symbol = $symbol;
39
        $this->decimalSeparator = $decimalSeparator;
40
        $this->thousandsSeparator = $thousandsSeparator;
41
        $this->symbolPosition = $symbolPosition;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getSymbol(): string
48
    {
49
        return $this->symbol;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getDecimalSeparator(): string
56
    {
57
        return $this->decimalSeparator;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getThousandsSeparator(): string
64
    {
65
        return $this->thousandsSeparator;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getSymbolPosition(): string
72
    {
73
        return $this->symbolPosition;
74
    }
75
76
    /**
77
     * @return string
78
     */
79
    public function getCode(): string
80
    {
81
        return $this->code;
82
    }
83
}
84