20 lines
546 B
PHP
20 lines
546 B
PHP
<?php
|
|
namespace Misuzu\Net;
|
|
|
|
use Misuzu\MszContext;
|
|
|
|
// remains for now for backwards compatibility with existing ::create methods
|
|
// plan is for those ::create methods to Fucking Die so that's fine for now
|
|
|
|
final class IPAddress {
|
|
private static MszContext $context;
|
|
|
|
public static function init(MszContext $ctx): void {
|
|
self::$context = $ctx;
|
|
}
|
|
|
|
public static function country(string $address, string $fallback = 'XX'): string {
|
|
return self::$context->getGeoIP()->getIsoCountryCode($address, $fallback);
|
|
}
|
|
}
|