public function getIsoStateByMagentoRegion(DataObject $address)
    {
        $map      = $this->getIsoToMagentoMapping();
        $sIsoCode = null;

        if ($address->getData('country_id') && $address->getData('region_code')) {
            $sIsoCode = $address->getData('country_id') . "-" . $address->getData('region_code');
        }

        if (isset($map[$address->getData('country_id')])) {
            foreach ($map[$address->getData('country_id')] as $isoCode => $mageCode) {
                if ($mageCode === $address->getData('region_code')) {
                    $sIsoCode = $address->getData('country_id') . "-" . $isoCode;
                    break;
                }
            }
        }

        return $sIsoCode;
    }
public function getIsoStateByMagentoRegion(DataObject $address)
    {
        $map      = $this->getIsoToMagentoMapping();
        $sIsoCode = null;

        if ($address->getData('country_id') && $address->getData('region_code')) {
            $sIsoCode = $address->getData('country_id') . "-" . $address->getData('region_code');
        }

        if (isset($map[$address->getData('country_id')])) {
            foreach ($map[$address->getData('country_id')] as $isoCode => $mageCode) {
                if ($mageCode === $address->getData('region_code')) {
                    $sIsoCode = $address->getData('country_id') . "-" . $isoCode;
                    break;
                }
            }
        }

        return $sIsoCode;
    }
public function getIsoStateByMagentoRegion ( DataObject $ address ) { $ map = $ this -> getIsoToMagentoMapping ( ) ; $ sIsoCode = null ; if ( $ address -> getData ( 'country_id' ) && $ address -> getData ( 'region_code' ) ) { $ sIsoCode = $ address -> getData ( 'country_id' ) . "-" . $ address -> getData ( 'region_code' ) ; } if ( isset ( $ map [ $ address -> getData ( 'country_id' ) ] ) ) { foreach ( $ map [ $ address -> getData ( 'country_id' ) ] as $ isoCode => $ mageCode ) { if ( $ mageCode === $ address -> getData ( 'region_code' ) ) { $ sIsoCode = $ address -> getData ( 'country_id' ) . "-" . $ isoCode ; break ; } } } return $ sIsoCode ; }
Return ISO-Code for Magento address

@param DataObject $address

@return null|string
Return ISO - Code for Magento address