composer-update-patch
This commit is contained in:
@@ -3,25 +3,44 @@
|
||||
use Illuminate\Support\Facades\App;
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
|
||||
if (!function_exists('phone_format')) {
|
||||
/**
|
||||
* Formats a phone number and country for display.
|
||||
*
|
||||
* @param string $phone
|
||||
* @param string $country
|
||||
* @param int|null $format
|
||||
* @return string
|
||||
*/
|
||||
function phone_format($phone, $country = null, $format = PhoneNumberFormat::INTERNATIONAL)
|
||||
{
|
||||
$lib = App::make('libphonenumber');
|
||||
if (! function_exists('phone_format')) {
|
||||
/**
|
||||
* Get the PhoneNumberUtil or format a phone number for display.
|
||||
*
|
||||
* @return \libphonenumber\PhoneNumberUtil|string
|
||||
*/
|
||||
function phone()
|
||||
{
|
||||
$lib = App::make('libphonenumber');
|
||||
|
||||
if (!$country) {
|
||||
$country = App::getLocale();
|
||||
}
|
||||
if (! $arguments = func_get_args()) {
|
||||
return $lib;
|
||||
}
|
||||
|
||||
$phoneNumber = $lib->parse($phone, $country);
|
||||
$phone = $arguments[0];
|
||||
$country = isset($arguments[1]) ? $arguments[1] : App::getLocale();
|
||||
$format = isset($arguments[2]) ? $arguments[2] : PhoneNumberFormat::INTERNATIONAL;
|
||||
|
||||
return $lib->format($phoneNumber, $format);
|
||||
}
|
||||
return $lib->format(
|
||||
$lib->parse($phone, $country),
|
||||
$format
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('phone_format')) {
|
||||
/**
|
||||
* Formats a phone number and country for display.
|
||||
*
|
||||
* @param string $phone
|
||||
* @param string $country
|
||||
* @param int|null $format
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.8.0
|
||||
*/
|
||||
function phone_format($phone, $country = null, $format = PhoneNumberFormat::INTERNATIONAL)
|
||||
{
|
||||
return phone($phone, $country, $format);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user