From 9a82052fdcec3064b297d1733b3a7f59bd865e07 Mon Sep 17 00:00:00 2001 From: Zhineng Li Date: Wed, 21 Jan 2026 15:22:15 +0800 Subject: rename and improve phpdoc --- src/RegionManager.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/RegionManager.php') 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 $codeToName - * @param array $relationships - * @param array $topLevels + * @param array $names The map of region codes to names. + * @param array $relationships The map of region codes to their child region codes. + * @param array $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.'); } -- cgit v1.2.3