/**
  * {@inheritdoc}
  */
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     if (empty($data)) {
         return null;
     }
     $metric = $this->factory->createMetric($context['attribute']->getMetricFamily());
     $metric->setData($this->localizer->localize($data['data'], $context));
     $metric->setUnit($data['unit']);
     return $metric;
 }
 /**
  * {@inheritdoc}
  */
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     if (empty($data)) {
         return null;
     }
     $prices = new ArrayCollection();
     foreach ($data as $priceData) {
         $data = $this->localizer->localize($priceData['data'], $context);
         $prices->add(new $this->productPriceClass($data, $priceData['currency']));
     }
     return $prices;
 }
 /**
  * Return the number provided. Do nothing because number is still formatted by denormalizer
  *
  * @param string $number
  *
  * @return string
  */
 public function transform($number)
 {
     return $this->localizer->localize($number, $this->options);
 }
 /**
  * {@inheritdoc}
  */
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     return '' === $data ? null : $this->localizer->localize($data, $context);
 }