6c8a8ea9a9
Improve CardDAV with write functions
26 lines
477 B
PHP
26 lines
477 B
PHP
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use Sabre\VObject\Component\VCard;
|
|
|
|
class VCardHelper
|
|
{
|
|
/**
|
|
* Get country model object from given VCard file.
|
|
*
|
|
* @param VCard $VCard
|
|
* @return null | string
|
|
*/
|
|
public static function getCountryISOFromSabreVCard(VCard $VCard)
|
|
{
|
|
$VCardAddress = $VCard->ADR;
|
|
|
|
if (empty($VCardAddress)) {
|
|
return;
|
|
}
|
|
|
|
return CountriesHelper::find($VCardAddress->getParts()[6]);
|
|
}
|
|
}
|