diff options
| author | Zhineng Li <[email protected]> | 2026-01-21 15:22:15 +0800 |
|---|---|---|
| committer | Zhineng Li <[email protected]> | 2026-01-21 15:22:15 +0800 |
| commit | 9a82052fdcec3064b297d1733b3a7f59bd865e07 (patch) | |
| tree | 6ed5cbfd64a749f67f3a556258a2d2d8c2806a73 /src/RegionManager.php | |
| parent | af463a24435f937b150934c73f268c60b389feb3 (diff) | |
| download | region-china-9a82052fdcec3064b297d1733b3a7f59bd865e07.tar.gz region-china-9a82052fdcec3064b297d1733b3a7f59bd865e07.zip | |
rename and improve phpdoc
Diffstat (limited to 'src/RegionManager.php')
| -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.'); } |
