Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LocaleQuantityProcessor.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Wishlist\Model;
8 
14 {
18  protected $localeResolver;
19 
23  protected $localFilter;
24 
29  public function __construct(
30  \Magento\Framework\Locale\ResolverInterface $localeResolver,
31  \Magento\Framework\Filter\LocalizedToNormalized $localFilter
32  ) {
33  $this->localeResolver = $localeResolver;
34  $this->localFilter = $localFilter;
35  }
36 
43  public function process($qty)
44  {
45  $this->localFilter->setOptions(['locale' => $this->localeResolver->getLocale()]);
46  $qty = $this->localFilter->filter((double)$qty);
47  if ($qty < 0) {
48  $qty = null;
49  }
50  return $qty;
51  }
52 }
__construct(\Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\Filter\LocalizedToNormalized $localFilter)