逻辑异常 / 德语行政区划键
德语行政区划键
v0.1.1
2021-06-30 17:15 UTC
Requires
- php: >=8.0
Requires (Dev)
- phpunit/phpunit: ^9
README
此包包含德语区域键AGS(官方社区键)和ARS(官方区域键)的类型和类。
您可以从以下网址下载所有德语行政区划的最新记录:
https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/_inhalt.html
如何使用
AGS
提供一个表示官方社区键数据对象的类。您可以通过构造函数传递AGS的每个部分或通过静态fromString方法解析AGS字符串来创建一个新对象。
// pass each part of AGS as constructor parameter $ags = new AGS("14", "7", "30", "070"); // pass full AGS string via parseString method $ags = AGS::fromString("14730070");
ARS
提供一个表示官方区域键数据对象的类。与AGS类类似,您可以通过构造函数参数传递ARS的每个部分或通过静态fromString方法解析ARS字符串。
// pass each part of ARS as constructor parameter $ars = new ARS("14", "7", "30", "0070", "070"); // pass full ARS string via parseString method $ars = ARS::fromString("147300070070");
技术上,ARS是AGS包含更多一些信息(联合会键)。因此,可以从ARS中提取AGS。相反,您不能从AGS创建ARS,因为信息不足(联合会键)。
$ars = new ARS("14", "7", "30", "0070", "070"); $ags = ars->toAGS(); echo (string)$ags; // prints: "14730070"