41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace OCA\Gestion\Helpers;
|
|
|
|
class FileExportHelpers
|
|
{
|
|
|
|
|
|
public static function FormatTextForExport(string $text){
|
|
$textFormatted = utf8_decode(html_entity_decode($text));
|
|
return $textFormatted;
|
|
}
|
|
|
|
public static function GetAddressAndCityFromAddress(string $adresse){
|
|
$adresseResult = "Aucun adresse";
|
|
$cityResult = "Aucune ville";
|
|
$adresses = explode("-",$adresse);
|
|
if(isset($adresses[0])){
|
|
$adresseResult = self::RemoveSpaceFromString($adresses[0]);
|
|
}
|
|
if(isset($adresses[1])){
|
|
$cityResult = self::RemoveSpaceFromString($adresses[1]);
|
|
}
|
|
return [
|
|
"address" => $adresseResult,
|
|
"city" => $cityResult
|
|
];
|
|
}
|
|
|
|
public static function GetSexeLabel(string $sexeKey){
|
|
return $sexeKey === 'f' ? 'Mme' : 'Mr';
|
|
}
|
|
|
|
public static function RemoveSpaceFromString(string $string){
|
|
$stringWithoutSpace = trim($string);
|
|
$stringWithoutSpace = str_replace(" ",'',$stringWithoutSpace);
|
|
return $stringWithoutSpace;
|
|
}
|
|
|
|
}
|