Geocoder\Provider\Nominatim::xmlResultToArray PHP Метод

xmlResultToArray() приватный Метод

private xmlResultToArray ( DOMElement $resultNode, DOMElement $addressNode )
$resultNode DOMElement
$addressNode DOMElement
    private function xmlResultToArray(\DOMElement $resultNode, \DOMElement $addressNode)
    {
        $adminLevels = [];
        foreach (['state', 'county'] as $i => $tagName) {
            if (null !== ($adminLevel = $this->getNodeValue($addressNode->getElementsByTagName($tagName)))) {
                $adminLevels[] = ['name' => $adminLevel, 'level' => $i + 1];
            }
        }
        // get the first postal-code when there are many
        $postalCode = current(explode(';', $this->getNodeValue($addressNode->getElementsByTagName('postcode'))));
        $result = ['latitude' => $resultNode->getAttribute('lat'), 'longitude' => $resultNode->getAttribute('lon'), 'postalCode' => $postalCode, 'adminLevels' => $adminLevels, 'streetNumber' => $this->getNodeValue($addressNode->getElementsByTagName('house_number')), 'streetName' => $this->getNodeValue($addressNode->getElementsByTagName('road')) ?: $this->getNodeValue($addressNode->getElementsByTagName('pedestrian')), 'locality' => $this->getNodeValue($addressNode->getElementsByTagName('city')), 'subLocality' => $this->getNodeValue($addressNode->getElementsByTagName('suburb')), 'country' => $this->getNodeValue($addressNode->getElementsByTagName('country')), 'countryCode' => strtoupper($this->getNodeValue($addressNode->getElementsByTagName('country_code')))];
        $boundsAttr = $resultNode->getAttribute('boundingbox');
        if ($boundsAttr) {
            $bounds = [];
            list($bounds['south'], $bounds['north'], $bounds['west'], $bounds['east']) = explode(',', $boundsAttr);
            $result['bounds'] = $bounds;
        }
        return $result;
    }