src/Apple/AppStore/Util/Parser.php
protected static function parseApplePriceMatrixTier(\DOMXPath $xpath, $indexTable, $currency)
    {
        $usdRowIndex = static::getIndexRowByCurrencyFromApplePriceMatrix($xpath, 'USD');
        $currencyRowIndex = static::getIndexRowByCurrencyFromApplePriceMatrix($xpath, $currency);

        $usdSelector = sprintf('//table[%d]//tr[position() > 2]/td[%d]', $indexTable, $usdRowIndex + 1);
        $currencySelector = sprintf('//table[%d]//tr[position() > 2]/td[%d]', $indexTable, $currencyRowIndex + 1);

        $usdPriceElements = $xpath->query($usdSelector);
        $currencyPriceElements = $xpath->query($currencySelector);

        if ($usdPriceElements->length != $currencyPriceElements->length) {
            throw new \RuntimeException(sprintf(
                'The USD price element have a "%d" elements, but %s price element have a "%d" elements.' .
                'Incorrect table?',
                $usdPriceElements->length,
                $currency,
                $currencyPriceElements->length
            ));
        }

        $prices = array();

        for ($i = 0; $i < $usdPriceElements->length; $i++) {
            $usdPriceElement = $usdPriceElements->item($i);
            $currencyPriceElement = $currencyPriceElements->item($i);

            $usdPrice = trim($usdPriceElement->textContent);
            $currencyPrice = trim($currencyPriceElement->textContent);

            if (!floatval($usdPrice)) {
                continue;
            }

            if (preg_match('/^(\d+)\.00$/', $currencyPrice, $parts)) {
                $currencyPrice = $parts[1];
            }

            $prices[$currencyPrice] = $usdPrice;
        }

        return $prices;
    }
protected static function parseApplePriceMatrixTier(\DOMXPath $xpath, $indexTable, $currency)
    {
        $usdRowIndex = static::getIndexRowByCurrencyFromApplePriceMatrix($xpath, 'USD');
        $currencyRowIndex = static::getIndexRowByCurrencyFromApplePriceMatrix($xpath, $currency);

        $usdSelector = sprintf('//table[%d]//tr[position() > 2]/td[%d]', $indexTable, $usdRowIndex + 1);
        $currencySelector = sprintf('//table[%d]//tr[position() > 2]/td[%d]', $indexTable, $currencyRowIndex + 1);

        $usdPriceElements = $xpath->query($usdSelector);
        $currencyPriceElements = $xpath->query($currencySelector);

        if ($usdPriceElements->length != $currencyPriceElements->length) {
            throw new \RuntimeException(sprintf(
                'The USD price element have a "%d" elements, but %s price element have a "%d" elements.' .
                'Incorrect table?',
                $usdPriceElements->length,
                $currency,
                $currencyPriceElements->length
            ));
        }

        $prices = array();

        for ($i = 0; $i < $usdPriceElements->length; $i++) {
            $usdPriceElement = $usdPriceElements->item($i);
            $currencyPriceElement = $currencyPriceElements->item($i);

            $usdPrice = trim($usdPriceElement->textContent);
            $currencyPrice = trim($currencyPriceElement->textContent);

            if (!floatval($usdPrice)) {
                continue;
            }

            if (preg_match('/^(\d+)\.00$/', $currencyPrice, $parts)) {
                $currencyPrice = $parts[1];
            }

            $prices[$currencyPrice] = $usdPrice;
        }

        return $prices;
    }
Parse price map from table (ApplePriceMatrix have a 2 table)

@param \DOMXPath $xpath
@param int       $indexTable
@param string    $currency

@return array

@throws \RuntimeException