From b0c5544a442371171db89c5ae40bb9c5c1b959b7 Mon Sep 17 00:00:00 2001 From: lichunqiang Date: Fri, 13 Mar 2015 13:10:33 +0800 Subject: [PATCH] formatted code style base on psr-2 --- src/GB2260.php | 94 ++++++++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/src/GB2260.php b/src/GB2260.php index e4f261f..cba49d1 100644 --- a/src/GB2260.php +++ b/src/GB2260.php @@ -1,43 +1,53 @@ - 6 || $codeLength % 2 !== 0) { - throw new \Exception('Invalid code'); - } - - $province = self::$_data[substr($code, 0, 2) . '0000']; - if (!$province) return null; - - if ($codeLength === 2) { - return $province; - } - - $area = self::$_data[substr($code, 0, 4) . '00']; - if (!$area) return null; - - if ($codeLength === 4) { - return $province . ' ' . $area; - } - - $name = self::$_data[$code]; - if (!$name) return null; - - return $province . ' ' . $area . ' ' . $name; - } + 6 || $codeLength % 2 !== 0) { + throw new \Exception('Invalid code'); + } + + $province = self::$_data[substr($code, 0, 2) . '0000']; + if (!$province) { + return null; + } + + if ($codeLength === 2) { + return $province; + } + + $area = self::$_data[substr($code, 0, 4) . '00']; + if (!$area) { + return null; + } + + if ($codeLength === 4) { + return $province . ' ' . $area; + } + + $name = self::$_data[$code]; + if (!$name) { + return null; + } + + return $province . ' ' . $area . ' ' . $name; + } } -