$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; } public static function ConvertSpecialChar($str) { $unwanted_array = array( 'Š'=>'S', 'š'=>'s', 'Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss', 'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y' ); return strtr( $str, $unwanted_array ); } public static function GetClientsFolder($clientName,$racinePath){ return $racinePath.'CLIENTS/'.mb_strtoupper($clientName,'UTF-8').'/'; } public static function GetFactureGroupFilename($factureNum,$clientName){ $factureNum = str_replace('/','-',$factureNum); $clientName = str_replace(' ',' ',$clientName ?? ''); return 'FACTURE'.'_'.$factureNum.'_'.mb_strtoupper($clientName,'UTF-8').'.pdf'; } public static function GetFactureGroupFolder($clientName,$facturationDate){ $clientRacineFolder = 'CLIENTS/'.mb_strtoupper($clientName,'UTF-8').'/'; $factureDatetime = new DateTime($facturationDate); $factureDateYear = $factureDatetime->format('Y'); $factureMonth = DateHelpers::GetDateWithFormatDayAndMonthPlainString($facturationDate); $factureByYearFolder = $clientRacineFolder."$factureDateYear".'/'.$factureMonth.'/'.'FACTURES'.'/'; return $factureByYearFolder; } public static function GetFactureGroupFileFullPath($clientName,$factureNum,$facturationDate){ $factureFolder = self::GetFactureGroupFolder($clientName,$facturationDate); $factureFilename = self::GetFactureGroupFilename($factureNum,$clientName); return $factureFolder.$factureFilename; } public static function GetDefuntsFolder($clientName,$defuntName,$racinePath){ $clientsFolder = self::GetClientsFolder($clientName,$racinePath); return $clientsFolder.'DEFUNTS/'.mb_strtoupper($defuntName,'UTF-8').'/'; } public static function GetBijouxOfDefuntFolder($clientName,$defuntName,$racinePath){ $defuntFolder = self::GetDefuntsFolder($clientName,$defuntName,$racinePath); return $defuntFolder.'BIJOUX/'; } public static function GetPacemakerPhotoFolderOfDefunt($clientName,$defuntName,$racinePath){ $defuntFolder = self::GetDefuntsFolder($clientName,$defuntName,$racinePath); return $defuntFolder.'PACEMAKER/'; } public static function GetLineCountForATextInAMaxWidth($pdf,$text,$maxWidth){ $words = explode(' ', $text); $lineWidth = 0; $lineCount = 1; foreach ($words as $word) { $wordWidth = $pdf->GetStringWidth($word . ' '); if ($lineWidth + $wordWidth > $maxWidth) { $lineCount++; $lineWidth = $wordWidth; } else { $lineWidth += $wordWidth; } } return $lineCount; } }