libphonenumber\PhoneNumber::getNationalNumber PHP Метод

getNationalNumber() публичный Метод

Returns the country code of this phone number.
public getNationalNumber ( ) : string | null
Результат string | null The national number, or null if not set.
    public function getNationalNumber()
    {
        return $this->nationalNumber;
    }

Usage Example

Пример #1
0
 /**
  * @param Message     $message
  * @param PhoneNumber $recipient
  * @throws SenderException
  * @return bool
  */
 public function send(Message $message, PhoneNumber $recipient)
 {
     $params = ['api_key' => $this->apiKey, 'api_secret' => $this->apiSecret, 'from' => $this->senderName, 'to' => $recipient->getCountryCode() . $recipient->getNationalNumber(), 'text' => $message->getContent(), 'type' => $message->getType() === Message::TYPE_UNICODE ? "unicode" : "text"];
     $url = self::NEXTMO_ENDPOINT . '?' . http_build_query($params);
     $response = $this->getResponse($url);
     if (false === isset($response['messages'])) {
         throw new SenderException('Invalid nexmo response: ' . var_export($response, true));
     }
     foreach ($response['messages'] as $message) {
         if ($message['status'] !== "0") {
             throw new SenderException($message['error-text'], $message['status']);
         }
     }
     return true;
 }
All Usage Examples Of libphonenumber\PhoneNumber::getNationalNumber