string()->length(2); $phoneUtil = $this->getPhoneNumberUtil(); $phoneNumber = $phoneUtil->parse( $number, strtoupper($iso2CountryCode) ); $number = ltrim($phoneUtil->format($phoneNumber, PhoneNumberFormat::E164), '+'); if (false === $phoneUtil->isValidNumber($phoneNumber)) { throw new RecipientException( ExceptionMessages::INVALID_SENDER ); } parent::__construct( $number); } /** * @return PhoneNumberUtil */ protected function getPhoneNumberUtil(): PhoneNumberUtil { return PhoneNumberUtil::getInstance(); } /** * @return int */ public function getFormatted() { return parent::getFormatted(); } }