Bridge/Symfony/Serializer/Helper/SubjectNormalizerHelper.php
public function normalizeStock(StockSubjectInterface $subject, $format = null, array $context = [])
    {
        $translator = $this->constantHelper->getTranslator();
        $formatter = $this->getFormatter();

        if (null !== $eda = $subject->getEstimatedDateOfArrival()) {
            $eda = $formatter->date($eda);
        } else {
            $eda = $translator->trans('ekyna_core.value.undefined');
        }

        $stockUnits = $this->findStockUnits($subject);

        return [
            'mode_label'    => $this->constantHelper->renderStockSubjectModeLabel($subject),
            'mode_badge'    => $this->constantHelper->renderStockSubjectModeBadge($subject),
            'state_label'   => $this->constantHelper->renderStockSubjectStateLabel($subject),
            'state_badge'   => $this->constantHelper->renderStockSubjectStateBadge($subject),
            'in'            => $formatter->number($subject->getInStock()),
            'available'     => $formatter->number($subject->getAvailableStock()),
            'virtual'       => $formatter->number($subject->getVirtualStock()),
            'floor'         => $formatter->number($subject->getStockFloor()),
            'geocode'       => $subject->getGeocode(),
            'replenishment' => $formatter->number($subject->getReplenishmentTime()),
            'eda'           => $eda,
            'moq'           => $formatter->number($subject->getMinimumOrderQuantity()),
            'quote_only'    => $subject->isQuoteOnly()
                ? $translator->trans('ekyna_core.value.yes')
                : $translator->trans('ekyna_core.value.no'),
            'end_of_life'   => $subject->isEndOfLife()
                ? $translator->trans('ekyna_core.value.yes')
                : $translator->trans('ekyna_core.value.no'),
            'stock_units'   => $this->normalizer->normalize($stockUnits, $format, $context),
        ];
    }
public function normalizeStock(StockSubjectInterface $subject, $format = null, array $context = [])
    {
        $translator = $this->constantHelper->getTranslator();
        $formatter = $this->getFormatter();

        if (null !== $eda = $subject->getEstimatedDateOfArrival()) {
            $eda = $formatter->date($eda);
        } else {
            $eda = $translator->trans('ekyna_core.value.undefined');
        }

        $stockUnits = $this->findStockUnits($subject);

        return [
            'mode_label'    => $this->constantHelper->renderStockSubjectModeLabel($subject),
            'mode_badge'    => $this->constantHelper->renderStockSubjectModeBadge($subject),
            'state_label'   => $this->constantHelper->renderStockSubjectStateLabel($subject),
            'state_badge'   => $this->constantHelper->renderStockSubjectStateBadge($subject),
            'in'            => $formatter->number($subject->getInStock()),
            'available'     => $formatter->number($subject->getAvailableStock()),
            'virtual'       => $formatter->number($subject->getVirtualStock()),
            'floor'         => $formatter->number($subject->getStockFloor()),
            'geocode'       => $subject->getGeocode(),
            'replenishment' => $formatter->number($subject->getReplenishmentTime()),
            'eda'           => $eda,
            'moq'           => $formatter->number($subject->getMinimumOrderQuantity()),
            'quote_only'    => $subject->isQuoteOnly()
                ? $translator->trans('ekyna_core.value.yes')
                : $translator->trans('ekyna_core.value.no'),
            'end_of_life'   => $subject->isEndOfLife()
                ? $translator->trans('ekyna_core.value.yes')
                : $translator->trans('ekyna_core.value.no'),
            'stock_units'   => $this->normalizer->normalize($stockUnits, $format, $context),
        ];
    }
public function normalizeStock ( StockSubjectInterface $ subject , $ format = null , array $ context = [ ] ) { $ translator = $ this -> constantHelper -> getTranslator ( ) ; $ formatter = $ this -> getFormatter ( ) ; if ( null !== $ eda = $ subject -> getEstimatedDateOfArrival ( ) ) { $ eda = $ formatter -> date ( $ eda ) ; } else { $ eda = $ translator -> trans ( 'ekyna_core.value.undefined' ) ; } $ stockUnits = $ this -> findStockUnits ( $ subject ) ; return [ 'mode_label' => $ this -> constantHelper -> renderStockSubjectModeLabel ( $ subject ) , 'mode_badge' => $ this -> constantHelper -> renderStockSubjectModeBadge ( $ subject ) , 'state_label' => $ this -> constantHelper -> renderStockSubjectStateLabel ( $ subject ) , 'state_badge' => $ this -> constantHelper -> renderStockSubjectStateBadge ( $ subject ) , 'in' => $ formatter -> number ( $ subject -> getInStock ( ) ) , 'available' => $ formatter -> number ( $ subject -> getAvailableStock ( ) ) , 'virtual' => $ formatter -> number ( $ subject -> getVirtualStock ( ) ) , 'floor' => $ formatter -> number ( $ subject -> getStockFloor ( ) ) , 'geocode' => $ subject -> getGeocode ( ) , 'replenishment' => $ formatter -> number ( $ subject -> getReplenishmentTime ( ) ) , 'eda' => $ eda , 'moq' => $ formatter -> number ( $ subject -> getMinimumOrderQuantity ( ) ) , 'quote_only' => $ subject -> isQuoteOnly ( ) ? $ translator -> trans ( 'ekyna_core.value.yes' ) : $ translator -> trans ( 'ekyna_core.value.no' ) , 'end_of_life' => $ subject -> isEndOfLife ( ) ? $ translator -> trans ( 'ekyna_core.value.yes' ) : $ translator -> trans ( 'ekyna_core.value.no' ) , 'stock_units' => $ this -> normalizer -> normalize ( $ stockUnits , $ format , $ context ) , ] ; }
Normalize the subject's stock data.

@param StockSubjectInterface $subject
@param string                $format
@param array                 $context

@return array
Normalize the subject s stock data .