__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Algo26\IdnaConvert;
use InvalidArgumentException;
abstract class AbstractIdnaConvert
{
abstract public function convert(string $host): string;
/**
* @param string $emailAddress
*
* @return string
*/
public function convertEmailAddress(string $emailAddress): string
{
if (strpos($emailAddress, '@') === false) {
throw new InvalidArgumentException('The given string does not look like an email address', 206);
}
$parts = explode('@', $emailAddress);
return sprintf(
'%s@%s',
$parts[0],
$this->convert($parts[1])
);
}
/**
* @param string $url
*
* @return string
*/
public function convertUrl(string $url): string
{
$parsed = parse_url($url);
if ($parsed === false) {
throw new InvalidArgumentException('The given string does not look like a URL', 206);
}
// Nothing to do
if (!isset($parsed['host']) || $parsed['host'] === null) {
return $url;
}
$parsed['host'] = $this->convert($parsed['host']);
return http_build_url($parsed);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| EncodingHelper | Folder | 0775 |
|
|
| Exception | Folder | 0775 |
|
|
| NamePrep | Folder | 0775 |
|
|
| Punycode | Folder | 0775 |
|
|
| TranscodeUnicode | Folder | 0775 |
|
|
| AbstractIdnaConvert.php | File | 1.18 KB | 0664 |
|
| IdnaConvertInterface.php | File | 249 B | 0664 |
|
| ToIdn.php | File | 1.94 KB | 0664 |
|
| ToUnicode.php | File | 969 B | 0664 |
|