Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RequestQuantityProcessor.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
11 
13 {
17  private $localeResolver;
18 
23  public function __construct(
24  ResolverInterface $localeResolver
25  ) {
26  $this->localeResolver = $localeResolver;
27  }
28 
35  public function process(array $cartData): array
36  {
37  $filter = new \Zend\I18n\Filter\NumberParse($this->localeResolver->getLocale());
38 
39  foreach ($cartData as $index => $data) {
40  if (isset($data['qty'])) {
41  $data['qty'] = is_string($data['qty']) ? trim($data['qty']) : $data['qty'];
42  $cartData[$index]['qty'] = $filter->filter($data['qty']);
43  }
44  }
45 
46  return $cartData;
47  }
48 }
$index
Definition: list.phtml:44