| @@ 138-150 (lines=13) @@ | ||
| 135 | * |
|
| 136 | * @return \CommerceGuys\Intl\Currency\CurrencyRepository |
|
| 137 | */ |
|
| 138 | protected function data() |
|
| 139 | { |
|
| 140 | $key = $this->getLocalesKey( |
|
| 141 | $locale = $this->getLocale(), |
|
| 142 | $fallbackLocale = $this->getFallbackLocale() |
|
| 143 | ); |
|
| 144 | ||
| 145 | if (! isset($this->data[$key])) { |
|
| 146 | $this->data[$key] = new CurrencyRepository($locale, $fallbackLocale); |
|
| 147 | } |
|
| 148 | ||
| 149 | return $this->data[$key]; |
|
| 150 | } |
|
| 151 | ||
| 152 | /** |
|
| 153 | * The current number formatter. |
|
| @@ 157-173 (lines=17) @@ | ||
| 154 | * |
|
| 155 | * @return \CommerceGuys\Intl\Formatter\CurrencyFormatter |
|
| 156 | */ |
|
| 157 | protected function formatter() |
|
| 158 | { |
|
| 159 | $key = $this->getLocalesKey( |
|
| 160 | $locale = $this->getLocale(), |
|
| 161 | $fallbackLocale = $this->getFallbackLocale() |
|
| 162 | ); |
|
| 163 | ||
| 164 | if (! isset($this->formatters[$key])) { |
|
| 165 | $this->formatters[$key] = new CurrencyFormatter( |
|
| 166 | new NumberFormatRepository($fallbackLocale), |
|
| 167 | $this->data(), |
|
| 168 | ['locale' => $locale] |
|
| 169 | ); |
|
| 170 | } |
|
| 171 | ||
| 172 | return $this->formatters[$key]; |
|
| 173 | } |
|
| 174 | ||
| 175 | /** |
|
| 176 | * Merges the options array. |
|
| @@ 84-96 (lines=13) @@ | ||
| 81 | * |
|
| 82 | * @return \CommerceGuys\Intl\Formatter\NumberFormatter |
|
| 83 | */ |
|
| 84 | protected function formatter() |
|
| 85 | { |
|
| 86 | $key = $this->getLocalesKey( |
|
| 87 | $locale = $this->getLocale(), |
|
| 88 | $fallbackLocale = $this->getFallbackLocale() |
|
| 89 | ); |
|
| 90 | ||
| 91 | if (! isset($this->formatters[$key])) { |
|
| 92 | $this->formatters[$key] = new NumberFormatter(new NumberFormatRepository($fallbackLocale), ['locale' => $locale]); |
|
| 93 | } |
|
| 94 | ||
| 95 | return $this->formatters[$key]; |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * Merges the options array. |
|