public function parse(array $variation)
    {
        $temporaryPrices = $this->getPricesAsSortedArray($variation['variationSalesPrices']);

        /**
         * @var Price[] $prices
         */
        $prices = [];
        foreach ($temporaryPrices as $customerGroup => $priceArray) {
            if (!isset($priceArray['default'])) {
                continue;
            }

            if ($customerGroup === 'default') {
                $customerGroup = null;
            }

            foreach ((array) $priceArray['default'] as $salesPrice) {
                $priceObject = new Price();
                $priceObject->setPrice($salesPrice['price']);
                $priceObject->setCustomerGroupIdentifier($customerGroup);
                $priceObject->setFromAmount($salesPrice['from']);

                $this->addPseudoPrice($priceObject, $priceArray);

                $prices[] = $priceObject;
            }
        }

        foreach ($prices as $price) {
            /**
             * @var Price[] $possibleScalePrices
             */
            $possibleScalePrices = array_filter($prices, function (Price $possiblePrice) use ($price) {
                return $possiblePrice->getCustomerGroupIdentifier() === $price->getCustomerGroupIdentifier() &&
                    spl_object_hash($price) !== spl_object_hash($possiblePrice);
            });

            if (empty($possibleScalePrices)) {
                continue;
            }

            usort($possibleScalePrices, function (Price $possibleScalePriceLeft, Price $possibleScalePriceright) {
                if ($possibleScalePriceLeft->getFromAmount() === $possibleScalePriceright->getFromAmount()) {
                    return 0;
                }

                if ($possibleScalePriceLeft->getFromAmount() > $possibleScalePriceright->getFromAmount()) {
                    return 1;
                }

                return -1;
            });

            foreach ($possibleScalePrices as $possibleScalePrice) {
                if ($possibleScalePrice->getFromAmount() > $price->getFromAmount()) {
                    $price->setToAmount($possibleScalePrice->getFromAmount() - 1);

                    break;
                }
            }
        }

        return $prices;
    }
public function parse(array $variation)
    {
        $temporaryPrices = $this->getPricesAsSortedArray($variation['variationSalesPrices']);

        /**
         * @var Price[] $prices
         */
        $prices = [];
        foreach ($temporaryPrices as $customerGroup => $priceArray) {
            if (!isset($priceArray['default'])) {
                continue;
            }

            if ($customerGroup === 'default') {
                $customerGroup = null;
            }

            foreach ((array) $priceArray['default'] as $salesPrice) {
                $priceObject = new Price();
                $priceObject->setPrice($salesPrice['price']);
                $priceObject->setCustomerGroupIdentifier($customerGroup);
                $priceObject->setFromAmount($salesPrice['from']);

                $this->addPseudoPrice($priceObject, $priceArray);

                $prices[] = $priceObject;
            }
        }

        foreach ($prices as $price) {
            /**
             * @var Price[] $possibleScalePrices
             */
            $possibleScalePrices = array_filter($prices, function (Price $possiblePrice) use ($price) {
                return $possiblePrice->getCustomerGroupIdentifier() === $price->getCustomerGroupIdentifier() &&
                    spl_object_hash($price) !== spl_object_hash($possiblePrice);
            });

            if (empty($possibleScalePrices)) {
                continue;
            }

            usort($possibleScalePrices, function (Price $possibleScalePriceLeft, Price $possibleScalePriceright) {
                if ($possibleScalePriceLeft->getFromAmount() === $possibleScalePriceright->getFromAmount()) {
                    return 0;
                }

                if ($possibleScalePriceLeft->getFromAmount() > $possibleScalePriceright->getFromAmount()) {
                    return 1;
                }

                return -1;
            });

            foreach ($possibleScalePrices as $possibleScalePrice) {
                if ($possibleScalePrice->getFromAmount() > $price->getFromAmount()) {
                    $price->setToAmount($possibleScalePrice->getFromAmount() - 1);

                    break;
                }
            }
        }

        return $prices;
    }
@param array $variation

@return Price[]