refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
28
app/Helpers/VCardHelper.php
Normal file
28
app/Helpers/VCardHelper.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Sabre\VObject\Component\VCard;
|
||||
|
||||
class VCardHelper
|
||||
{
|
||||
/**
|
||||
* Get country model object from given VCard file.
|
||||
*
|
||||
* @param VCard $vCard
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getCountryISOFromSabreVCard(VCard $vCard): ?string
|
||||
{
|
||||
$vCardAddress = $vCard->ADR;
|
||||
|
||||
if (empty($vCardAddress)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$country = Arr::get($vCardAddress->getParts(), '6');
|
||||
|
||||
return empty($country) ? null : CountriesHelper::find($country);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user