summaryrefslogtreecommitdiff
path: root/src/RegionManager.php
diff options
context:
space:
mode:
authorZhineng Li <[email protected]>2026-01-21 15:22:15 +0800
committerZhineng Li <[email protected]>2026-01-21 15:22:15 +0800
commit9a82052fdcec3064b297d1733b3a7f59bd865e07 (patch)
tree6ed5cbfd64a749f67f3a556258a2d2d8c2806a73 /src/RegionManager.php
parentaf463a24435f937b150934c73f268c60b389feb3 (diff)
downloadregion-china-9a82052fdcec3064b297d1733b3a7f59bd865e07.tar.gz
region-china-9a82052fdcec3064b297d1733b3a7f59bd865e07.zip
rename and improve phpdoc
Diffstat (limited to 'src/RegionManager.php')
-rw-r--r--src/RegionManager.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/RegionManager.php b/src/RegionManager.php
index daf49eb..006a523 100644
--- a/src/RegionManager.php
+++ b/src/RegionManager.php
@@ -7,12 +7,12 @@ namespace Zhineng\RegionChina;
final class RegionManager
{
/**
- * @param array<string, string> $codeToName
- * @param array<string, int[]> $relationships
- * @param array<int, int[]> $topLevels
+ * @param array<string, string> $names The map of region codes to names.
+ * @param array<string, int[]> $relationships The map of region codes to their child region codes.
+ * @param array<int, int[]> $topLevels A list of top-level region codes.
*/
public function __construct(
- private array $codeToName,
+ private array $names,
private array $relationships,
private array $topLevels
) {
@@ -30,7 +30,7 @@ final class RegionManager
public function getName(int $code): string
{
- return $this->codeToName[$this->groupKey($code)]
+ return $this->names[$this->groupKey($code)]
?? throw new RegionException('The region code does not exist.');
}