public static function fromDecimal($number)
{
// Only convert code points within planes 0-2, excluding NULL
if (empty($number) || $number > 0x2ffff) {
return self::fromHex('fffd');
}
$entity = '&#' . $number . ';';
$converted = mb_decode_numericentity($entity, [0x0, 0x2ffff, 0, 0xffff], 'UTF-8');
if ($converted === $entity) {
return self::fromHex('fffd');
}
return $converted;
}