Adapter/PlentymarketsAdapter/ResponseParser/Product/Price/PriceResponseParser.php
private function getPricesAsSortedArray(array $variationSalesPrices = [])
    {
        $priceConfigurations = $this->getPriceConfigurations();

        if (empty($priceConfigurations)) {
            $this->logger->notice('no valid price configuration found');

            return [];
        }

        static $customerGroups;

        if (null === $customerGroups) {
            $customerGroups = array_keys($this->itemsAccountsContacsClasses->findAll());
        }

        $temporaryPrices = [];

        foreach ($variationSalesPrices as $price) {
            $priceConfiguration = $this->filterPriceConfiguration($priceConfigurations, $price);

            if (empty($priceConfiguration)) {
                // no price configuration found, skip price

                continue;
            }

            $priceConfiguration = array_shift($priceConfiguration);
            $customerClasses = (array) $priceConfiguration['customerClasses'];
            $from = (float) $priceConfiguration['minimumOrderQuantity'];

            if (count($customerClasses) === 1 && $customerClasses[0]['customerClassId'] === -1) {
                foreach ($customerGroups as $group) {
                    $customerGroupIdentity = $this->identityService->findOneBy([
                        'adapterIdentifier' => $group,
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => CustomerGroup::TYPE,
                    ]);

                    if (null === $customerGroupIdentity) {
                        continue;
                    }

                    $customerGroup = $customerGroupIdentity->getObjectIdentifier();

                    $temporaryPrices[$customerGroup][$priceConfiguration['type']][$from] = [
                        'from' => $from,
                        'price' => (float) $price['price'],
                    ];
                }
            } else {
                foreach ($customerClasses as $group) {
                    $customerGroupIdentity = $this->identityService->findOneBy([
                        'adapterIdentifier' => $group['customerClassId'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => CustomerGroup::TYPE,
                    ]);

                    if (null === $customerGroupIdentity) {
                        continue;
                    }

                    $customerGroup = $customerGroupIdentity->getObjectIdentifier();

                    $temporaryPrices[$customerGroup][$priceConfiguration['type']][$from] = [
                        'from' => $from,
                        'price' => (float) $price['price'],
                    ];
                }
            }
        }

        return $temporaryPrices;
    }
private function getPricesAsSortedArray(array $variationSalesPrices = [])
    {
        $priceConfigurations = $this->getPriceConfigurations();

        if (empty($priceConfigurations)) {
            $this->logger->notice('no valid price configuration found');

            return [];
        }

        static $customerGroups;

        if (null === $customerGroups) {
            $customerGroups = array_keys($this->itemsAccountsContacsClasses->findAll());
        }

        $temporaryPrices = [];

        foreach ($variationSalesPrices as $price) {
            $priceConfiguration = $this->filterPriceConfiguration($priceConfigurations, $price);

            if (empty($priceConfiguration)) {
                // no price configuration found, skip price

                continue;
            }

            $priceConfiguration = array_shift($priceConfiguration);
            $customerClasses = (array) $priceConfiguration['customerClasses'];
            $from = (float) $priceConfiguration['minimumOrderQuantity'];

            if (count($customerClasses) === 1 && $customerClasses[0]['customerClassId'] === -1) {
                foreach ($customerGroups as $group) {
                    $customerGroupIdentity = $this->identityService->findOneBy([
                        'adapterIdentifier' => $group,
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => CustomerGroup::TYPE,
                    ]);

                    if (null === $customerGroupIdentity) {
                        continue;
                    }

                    $customerGroup = $customerGroupIdentity->getObjectIdentifier();

                    $temporaryPrices[$customerGroup][$priceConfiguration['type']][$from] = [
                        'from' => $from,
                        'price' => (float) $price['price'],
                    ];
                }
            } else {
                foreach ($customerClasses as $group) {
                    $customerGroupIdentity = $this->identityService->findOneBy([
                        'adapterIdentifier' => $group['customerClassId'],
                        'adapterName' => PlentymarketsAdapter::NAME,
                        'objectType' => CustomerGroup::TYPE,
                    ]);

                    if (null === $customerGroupIdentity) {
                        continue;
                    }

                    $customerGroup = $customerGroupIdentity->getObjectIdentifier();

                    $temporaryPrices[$customerGroup][$priceConfiguration['type']][$from] = [
                        'from' => $from,
                        'price' => (float) $price['price'],
                    ];
                }
            }
        }

        return $temporaryPrices;
    }
@param array $variationSalesPrices

@return array