@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Adsmurai\Currency; |
6 | 6 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 1 === \preg_match(self::getAmountPlusIsoCodePattern($currencyType), $amount, $matches) || |
80 | 80 | 1 === \preg_match(self::getAmountPlusSymbolPattern($currencyType), $amount, $matches) |
81 | 81 | ) { |
82 | - return Decimal::fromString($matches['amount'], self::INNER_FRACTIONAL_DIGITS); |
|
82 | + return Decimal::fromString($matches[ 'amount' ], self::INNER_FRACTIONAL_DIGITS); |
|
83 | 83 | } else { |
84 | 84 | throw new InvalidArgumentException('Invalid currency value'); |
85 | 85 | } |
@@ -32,6 +32,6 @@ |
||
32 | 32 | */ |
33 | 33 | public function getInconsistentCurrencyTypes(): array |
34 | 34 | { |
35 | - return [$this->ct1, $this->ct2]; |
|
35 | + return [ $this->ct1, $this->ct2 ]; |
|
36 | 36 | } |
37 | 37 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Adsmurai\Currency; |
6 | 6 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $symbol = \trim($symbol); |
31 | 31 | $name = \trim($name); |
32 | 32 | |
33 | - if (!in_array($symbolPlacement, [self::BEFORE_PLACEMENT, self::AFTER_PLACEMENT])) { |
|
33 | + if (!in_array($symbolPlacement, [ self::BEFORE_PLACEMENT, self::AFTER_PLACEMENT ])) { |
|
34 | 34 | throw new InvalidArgumentException('Invalid symbol placement'); |
35 | 35 | } |
36 | 36 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Adsmurai\Currency; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Adsmurai\Currency; |
6 | 6 | |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | public function getCurrencyFactory(string $isoCode): CurrencyFactoryInterface |
25 | 25 | { |
26 | - if (!isset($this->currencyFactories[$isoCode])) { |
|
27 | - $this->currencyFactories[$isoCode] = new CurrencyFactory( |
|
26 | + if (!isset($this->currencyFactories[ $isoCode ])) { |
|
27 | + $this->currencyFactories[ $isoCode ] = new CurrencyFactory( |
|
28 | 28 | $this->currencyTypeFactory->buildFromISOCode($isoCode) |
29 | 29 | ); |
30 | 30 | } |
31 | 31 | |
32 | - return $this->currencyFactories[$isoCode]; |
|
32 | + return $this->currencyFactories[ $isoCode ]; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** @return string[] */ |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Adsmurai\Currency; |
6 | 6 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | private function __construct(array $data) |
23 | 23 | { |
24 | 24 | $this->data = $data; |
25 | - $this->currencyTypes = []; |
|
25 | + $this->currencyTypes = [ ]; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public static function fromDataPath(string $dataPath = self::DEFAULT_DATA_PATH): CurrencyTypeFactory |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | private static function hasValidSymbol(array $currencyData): bool |
72 | 72 | { |
73 | 73 | return |
74 | - isset($currencyData['symbol']) |
|
75 | - && \is_string($currencyData['symbol']) |
|
76 | - && !empty($currencyData['symbol']); |
|
74 | + isset($currencyData[ 'symbol' ]) |
|
75 | + && \is_string($currencyData[ 'symbol' ]) |
|
76 | + && !empty($currencyData[ 'symbol' ]); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | private static function hasValidSymbolPlacement(array $currencyData): bool |
80 | 80 | { |
81 | 81 | return |
82 | - isset($currencyData['symbolPlacement']) |
|
83 | - && \is_int($currencyData['symbolPlacement']) |
|
82 | + isset($currencyData[ 'symbolPlacement' ]) |
|
83 | + && \is_int($currencyData[ 'symbolPlacement' ]) |
|
84 | 84 | && \in_array( |
85 | - $currencyData['symbolPlacement'], |
|
85 | + $currencyData[ 'symbolPlacement' ], |
|
86 | 86 | [ |
87 | 87 | CurrencyTypeInterface::BEFORE_PLACEMENT, |
88 | 88 | CurrencyTypeInterface::AFTER_PLACEMENT, |
@@ -92,28 +92,28 @@ discard block |
||
92 | 92 | |
93 | 93 | private static function hasValidNumFractionalDigits(array $currencyData): bool |
94 | 94 | { |
95 | - return isset($currencyData['numFractionalDigits']) && \is_int($currencyData['numFractionalDigits']); |
|
95 | + return isset($currencyData[ 'numFractionalDigits' ]) && \is_int($currencyData[ 'numFractionalDigits' ]); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function buildFromISOCode(string $ISOCode): CurrencyTypeInterface |
99 | 99 | { |
100 | - if (!isset($this->data[$ISOCode])) { |
|
100 | + if (!isset($this->data[ $ISOCode ])) { |
|
101 | 101 | throw new UnsupportedCurrencyISOCodeError($ISOCode); |
102 | 102 | } |
103 | 103 | |
104 | - if (!isset($this->currencyTypes[$ISOCode])) { |
|
105 | - $this->currencyTypes[$ISOCode] = new CurrencyType( |
|
104 | + if (!isset($this->currencyTypes[ $ISOCode ])) { |
|
105 | + $this->currencyTypes[ $ISOCode ] = new CurrencyType( |
|
106 | 106 | $ISOCode, |
107 | - $this->data[$ISOCode]['symbol'], |
|
108 | - $this->data[$ISOCode]['numFractionalDigits'], |
|
109 | - $this->data[$ISOCode]['symbolPlacement'], |
|
110 | - (isset($this->data[$ISOCode]['name']) && !empty($this->data[$ISOCode]['name'])) |
|
111 | - ? $this->data[$ISOCode]['name'] |
|
107 | + $this->data[ $ISOCode ][ 'symbol' ], |
|
108 | + $this->data[ $ISOCode ][ 'numFractionalDigits' ], |
|
109 | + $this->data[ $ISOCode ][ 'symbolPlacement' ], |
|
110 | + (isset($this->data[ $ISOCode ][ 'name' ]) && !empty($this->data[ $ISOCode ][ 'name' ])) |
|
111 | + ? $this->data[ $ISOCode ][ 'name' ] |
|
112 | 112 | : '' |
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
116 | - return $this->currencyTypes[$ISOCode]; |
|
116 | + return $this->currencyTypes[ $ISOCode ]; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** @return string[] */ |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Adsmurai\Currency\Data; |
6 | 6 |