@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // @codeCoverageIgnoreStart |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Adsmurai\Currency\Data; |
| 6 | 6 | |
@@ -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 @@ |
||
| 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 | |
@@ -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 @@ 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 getMoneyFactory(string $isoCode): MoneyFactoryContract |
| 25 | 25 | { |
| 26 | - if (!isset($this->moneyFactories[$isoCode])) { |
|
| 27 | - $this->moneyFactories[$isoCode] = new MoneyFactory( |
|
| 26 | + if (!isset($this->moneyFactories[ $isoCode ])) { |
|
| 27 | + $this->moneyFactories[ $isoCode ] = new MoneyFactory( |
|
| 28 | 28 | $this->currencyFactory->buildFromISOCode($isoCode) |
| 29 | 29 | ); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - return $this->moneyFactories[$isoCode]; |
|
| 32 | + return $this->moneyFactories[ $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->currencies = []; |
|
| 25 | + $this->currencies = [ ]; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public static function fromDataPath(string $dataPath = self::DEFAULT_DATA_PATH): CurrencyFactory |
@@ -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 | CurrencyContract::BEFORE_PLACEMENT, |
| 88 | 88 | CurrencyContract::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): CurrencyContract |
| 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->currencies[$ISOCode])) { |
|
| 105 | - $this->currencies[$ISOCode] = new Currency( |
|
| 104 | + if (!isset($this->currencies[ $ISOCode ])) { |
|
| 105 | + $this->currencies[ $ISOCode ] = new Currency( |
|
| 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->currencies[$ISOCode]; |
|
| 116 | + return $this->currencies[ $ISOCode ]; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** @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 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | 1 === \preg_match(self::getAmountPlusIsoCodePattern($currency), $amount, $matches) || |
| 79 | 79 | 1 === \preg_match(self::getAmountPlusSymbolPattern($currency), $amount, $matches) |
| 80 | 80 | ) { |
| 81 | - return Decimal::fromString($matches['amount'], self::INNER_FRACTIONAL_DIGITS); |
|
| 81 | + return Decimal::fromString($matches[ 'amount' ], self::INNER_FRACTIONAL_DIGITS); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | throw new InvalidArgumentException('Invalid currency value'); |