2021-05-21 08:49:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Xentral\Modules\Ticket\Importer;
|
|
|
|
|
|
|
|
class TicketFormatter
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param string $rawEmail
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function formatEmail(string $rawEmail): string
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $string
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function encodeToUtf8(string $string): string
|
|
|
|
{
|
|
|
|
|
2023-01-12 00:01:20 +01:00
|
|
|
$converted = mb_convert_encoding(
|
2021-05-21 08:49:41 +02:00
|
|
|
$string,
|
|
|
|
'UTF-8',
|
2023-01-12 00:01:20 +01:00
|
|
|
'auto'
|
2021-05-21 08:49:41 +02:00
|
|
|
);
|
2023-01-12 00:01:20 +01:00
|
|
|
|
|
|
|
// Fallback
|
|
|
|
if ($converted === false) {
|
|
|
|
$converted = mb_convert_encoding(
|
|
|
|
$string,
|
|
|
|
'UTF-8',
|
|
|
|
'iso-8859-1'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ($converted);
|
2021-05-21 08:49:41 +02:00
|
|
|
}
|
|
|
|
}
|