diff options
| -rw-r--r-- | src/RegionManager.php | 10 |
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.'); } |
