Skip to content

Commit a2863bc

Browse files
Merge remote-tracking branch 'origin/MAGETWO-35361' into BUGS
2 parents e43fce2 + e202700 commit a2863bc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/internal/Magento/Framework/Locale/Format.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,17 @@ public function getNumber($value)
8282
* Functions returns array with price formatting info
8383
*
8484
* @return array
85+
* @SuppressWarnings(PHPMD.NPathComplexity)
8586
*/
8687
public function getPriceFormat()
8788
{
88-
$numberElements = (new DataBundle())->get($this->_localeResolver->getLocale())['NumberElements'];
89-
$format = $numberElements['latn']['patterns']['currencyFormat'];
90-
$symbols = $numberElements['latn']['symbols'];
89+
$localeData = (new DataBundle())->get($this->_localeResolver->getLocale());
90+
$format = $localeData['NumberElements']['latn']['patterns']['currencyFormat']
91+
?: explode(';', $localeData['NumberPatterns'][1])[0];
92+
$decimalSymbol = $localeData['NumberElements']['latn']['symbols']['decimal']
93+
?: $localeData['NumberElements'][0];
94+
$groupSymbol = $localeData['NumberElements']['latn']['symbols']['group']
95+
?: $localeData['NumberElements'][1];
9196

9297
$pos = strpos($format, ';');
9398
if ($pos !== false) {
@@ -120,8 +125,8 @@ public function getPriceFormat()
120125
'pattern' => $this->_scopeResolver->getScope()->getCurrentCurrency()->getOutputFormat(),
121126
'precision' => $totalPrecision,
122127
'requiredPrecision' => $requiredPrecision,
123-
'decimalSymbol' => $symbols['decimal'],
124-
'groupSymbol' => $symbols['group'],
128+
'decimalSymbol' => $decimalSymbol,
129+
'groupSymbol' => $groupSymbol,
125130
'groupLength' => $group,
126131
'integerRequired' => $integerRequired,
127132
];

0 commit comments

Comments
 (0)