Returns information if given phone number is valid

@param string $phoneNumber The phone number to validate / verify
@return bool
434551
public static function isValidPhoneNumber($phoneNumber)
    {
        /*
         * Not a string?
         * Nothing to do
         */
        if (!is_string($phoneNumber)) {
            return false;
        }

        $pattern = self::getPhoneNumberPattern();

        return (bool)preg_match($pattern, trim($phoneNumber));
    }
117666
public static function validate($phone, $region = 'RU')
    {
        try {
            return self::phoneUtil()->isValidNumberForRegion(self::phoneUtil()->parse($phone, $region), $region);
        } catch (NumberParseException $e) {
            return false;
        }
    }
1012691
public function isValidVATNumber($vatNumber)
    {
        $details = self::getVATDetails($vatNumber);

        if ($details) {
            return $details->valid;
        } else {
            return false;
        }
    }
876113
@SuppressWarnings("unused")
    public boolean isValid() {
        Phonenumber.PhoneNumber phoneNumber = getPhoneNumber();
        return phoneNumber != null && mPhoneUtil.isValidNumber(phoneNumber);
    }
607029
public function isValid()
    {
        $result = true;
        $fields = $this->getFields();
        // Check each element for validators, validate them and return the result.
        foreach ($fields as $field) {
            if ($field->validate() == false) {
                $result = false;
            }
        }
        return $result;
    }
133597
protected function formatPhoneNumber($phoneNumber)
    {
        if (strlen($phoneNumber) > 10) {
            $countryCode = substr($phoneNumber, 0, strlen($phoneNumber)-10);
            $areaCode = substr($phoneNumber, -10, 3);
            $nextThree = substr($phoneNumber, -7, 3);
            $lastFour = substr($phoneNumber, -4, 4);
            $phoneNumber = '+' . $countryCode . ' (' . $areaCode . ') ' . $nextThree . '-' . $lastFour;
        } elseif (strlen($phoneNumber) === 10) {
            $areaCode = substr($phoneNumber, 0, 3);
            $nextThree = substr($phoneNumber, 3, 3);
            $lastFour = substr($phoneNumber, 6, 4);
            $phoneNumber = '(' . $areaCode . ') ' . $nextThree . '-' . $lastFour;
        } elseif (strlen($phoneNumber) === 7) {
            $nextThree = substr($phoneNumber, 0, 3);
            $lastFour = substr($phoneNumber, 3, 4);
            $phoneNumber = $nextThree . '-' . $lastFour;
        }

        return $phoneNumber;
    }
719874
public function getPhoneInfo($bookID, $phoneNumber)
    {
        if (empty($bookID)) {
            return $this->handleError('Empty book id');
        }

        $requestResult = $this->sendRequest('/sms/numbers/info/'.$bookID.'/'.$phoneNumber);

        return $this->handleResult($requestResult);
    }
80875
private function isLengthValid()
    {
        $countryCode = $this->getCountryCode();
        $validLength = static::COUNTRY_CODE_LENGTH + static::CHECKSUM_LENGTH + static::$ibanFormatMap[$countryCode][0];

        return strlen($this->iban) === $validLength;
    }
764253
protected function checkFormat($cardNumber)
    {
        return preg_match('/^[0-9]+$/', $cardNumber) && preg_match($this->patterns[$this->format], $cardNumber);
    }
701156
private function checkCallable()
    {
        if (is_null($this->callable) || !is_callable($this->callable)) {
            $this->callable = function ($data) {
                $name = $this->name;

                if (is_array($data) && array_key_exists($name, $data)) {
                    return $data[$name];
                }

                if (is_object($data) && property_exists($data, $name)) {
                    return $data->$name;
                }

                if (is_object($data) && method_exists($data, $name)) {
                    return $data->$name();
                }

                return "";
            };
        }
    }
461366
public static function isPhoneNumber($value) {
        if (!is_string($value)) return false;

        // handle empty value
        $value = trim($value);
        if (!strlen($value)) return false;

        // remove spaces
        $value = str_replace(' ', '', $value);

        // match numbers from BE, ES, BG, CH, A, UK, DE
        return (bool) preg_match('/^(00|\+)(32|34|359|41|43|44|49)-?[1-9](-?[0-9]){2,}$/', $value);

        // TODO: implement via https://github.com/giggsey/libphonenumber-for-php
    }
1106175
public function isValid()
    {
        if (!$this->hasValidFormat()) {
            return false;
        }

        $vn_has_to_be = $this->calculateVerificationNumber();
        if ($this->vn == $vn_has_to_be) {
            return true;
        }

        return false;
    }
1211476
public function formatMsisdn($phone_number = '', $format = NULL)
    {
        if (empty($phone_number)) {
            return NULL;
        }
        try {
            if (mb_strpos('*', $phone_number) || mb_strpos('x', $phone_number)) {
                return $phone_number;
            } else {
                if (self::MSISDN_FORMAT_MODE == 'new' || self::MSISDN_FORMAT_MODE == 'old') {
                    $BasePhoneNumber = new BasePhoneNumber();
                    $phone_number    = $BasePhoneNumber->phone_number_convert($phone_number, self::MSISDN_FORMAT_MODE, $format);
                } else {
                    $phone_number = $this->phoneNumber->format($phone_number, $format);
                }

                return $phone_number;
            }
        }
        catch (\Exception $e) {
            return $phone_number;
        }
    }
954204
public function isValid()
    {
        return ((!empty($this->hex) && ctype_xdigit($this->hex)) && (!empty($this->dec) && ctype_digit($this->dec)));
    }
368658
protected function phone($key) : bool
    {
        $num = preg_replace('/d+/', '', (int) $this->param[$key]);

        $conCate = '';
        $columnName = ucfirst($this->convertToFieldName($key)).' should be ';
        if (isset($this->errors[$key.self::ERROR])) {
            $conCate = str_replace('.', '', $this->errors[$key.self::ERROR]).' and ';
            $columnName = '';
        }

        if (in_array(strlen($num), $this->validPhoneNumbers) == false) {
            $this->errors[$key.self::ERROR] = $conCate.$columnName.'valid phone number.';

            return false;
        }

        return true;
    }
757578
private function validateIENew(string $vatNumber): bool
    {
        $checksum = strtoupper(substr($vatNumber, 7, 1));
        $checkNumber = substr($vatNumber, 0, 8);
        $checkval = 0;

        for ($i = 2; $i <= 8; $i++) {
            $checkval += (int)$checkNumber[8 - $i] * $i;
        }

        if (strlen($vatNumber) == 9) {
            $checkval += (9 * strpos($this->alphabet, $vatNumber[8]));
        }

        $checkval = ($checkval % 23);

        if ($checkval == 0) {
            return $checksum == 'W';
        }

        $checkchar = 'A';
        for ($i = $checkval - 1; $i > 0; $i--) {
            $checkchar++;
        }

        return $checkchar == $checksum;
    }
924599
protected function extractDddPhone($phoneNumber)
    {
        $arrayPhone = array();
        $phone = preg_replace("/[^0-9]/", "", $phoneNumber);
        if(substr( $phone, 0, 1 ) === "0"){
            $arrayPhone['ddd'] = substr($phone, 1, 2);
            $arrayPhone['number'] = substr($phone, 3);
        } elseif (strlen($phone) < 10 ) {
            $arrayPhone['ddd'] = '';
            $arrayPhone['number'] = $phone;
        } else {
            $arrayPhone['ddd'] = substr($phone, 0, 2);
            $arrayPhone['number'] = substr($phone, 2);
        }

        return $arrayPhone;
    }