Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: get all codes #86

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 46 additions & 45 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions src/Utopia/Messaging/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Utopia\Messaging;

use Exception;
use libphonenumber\PhoneNumberUtil;

abstract class Adapter
{
Expand Down Expand Up @@ -251,28 +250,4 @@ protected function requestMulti(

return $responses;
}


/**
* @param string $phone
* @return int|null
* @throws Exception
*/
public function getCountryCode(string $phone): ?int
{
if (empty($phone)) {
throw new Exception('$phone cannot be empty.');
}

$helper = PhoneNumberUtil::getInstance();

try {
return $helper
->parse($phone)
->getCountryCode();

} catch (\Throwable $th) {
throw new Exception("Error parsing phone: " . $th->getMessage());
}
}
}
Loading
Loading