| Server IP : 104.21.84.107 / Your IP : 104.23.197.208 Web Server : Apache/2.4.63 (Ubuntu) System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.4.5 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/pregrados/biologia/libraries/vendor/algo26-matthias/idna-convert/src/ |
Upload File : |
<?php
namespace Algo26\IdnaConvert;
use Algo26\IdnaConvert\Punycode\FromPunycode;
use Algo26\IdnaConvert\TranscodeUnicode\TranscodeUnicode;
class ToUnicode extends AbstractIdnaConvert implements IdnaConvertInterface
{
/** @var TranscodeUnicode */
private $unicodeTransCoder;
/** @var FromPunycode */
private $punycodeEncoder;
public function __construct()
{
$this->unicodeTransCoder = new TranscodeUnicode();
$this->punycodeEncoder = new FromPunycode();
}
public function convert(string $host): string
{
// Drop any whitespace around
$input = trim($host);
$hostLabels = explode('.', $input);
foreach ($hostLabels as $index => $label) {
$return = $this->punycodeEncoder->convert($label);
if (!$return) {
$return = $label;
}
$hostLabels[$index] = $return;
}
return implode('.', $hostLabels);
}
}