You are here

public function MobileNumberUtil::getCountry in Mobile Number 2.0.x

Same name and namespace in other branches
  1. 8 src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::getCountry()

Get country code.

Parameters

\libphonenumber\PhoneNumber $mobile_number: Phone number object.

Return value

string Country code.

Overrides MobileNumberUtilInterface::getCountry

File

src/MobileNumberUtil.php, line 180

Class

MobileNumberUtil
Turns a render array into a HTML string.

Namespace

Drupal\mobile_number

Code

public function getCountry(PhoneNumber $mobile_number) {
  return $mobile_number ? $this
    ->libUtil()
    ->getRegionCodeForNumber($mobile_number) : NULL;
}