From 2e260d8c7e3df1f9209a90f20b90846ef26044fa Mon Sep 17 00:00:00 2001 From: Abdelrahman Omran Date: Fri, 7 Apr 2017 21:33:53 +0200 Subject: [PATCH] Rename country variable to countryCode for naming consistency --- src/Country.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Country.php b/src/Country.php index b822d8a..37f5976 100644 --- a/src/Country.php +++ b/src/Country.php @@ -141,30 +141,30 @@ public function getOfficialName() /** * Get the given native name or fallback to first native name. * - * @param string|null $language + * @param string|null $languageCode * * @return string|null */ - public function getNativeName($language = null) + public function getNativeName($languageCode = null) { - $language = $language ? mb_strtolower($language) : null; + $languageCode = $languageCode ? mb_strtolower($languageCode) : null; - return $this->get("name.native.{$language}.common") + return $this->get("name.native.{$languageCode}.common") ?: (current($this->get('name.native', []))['common'] ?: $this->get('native_name')); } /** * Get the given native official name or fallback to first native official name. * - * @param string|null $language + * @param string|null $languageCode * * @return string|null */ - public function getNativeOfficialName($language = null) + public function getNativeOfficialName($languageCode = null) { - $language = $language ? mb_strtolower($language) : null; + $languageCode = $languageCode ? mb_strtolower($languageCode) : null; - return $this->get("name.native.{$language}.official") + return $this->get("name.native.{$languageCode}.official") ?: (current($this->get('name.native', []))['official'] ?: $this->get('native_official_name')); } @@ -285,15 +285,15 @@ public function getAltSpellings() /** * Get the given language or fallback to first language. * - * @param string|null $language + * @param string|null $languageCode * * @return string|null */ - public function getLanguage($language = null) + public function getLanguage($languageCode = null) { - $language = $language ? mb_strtoupper($language) : null; + $languageCode = $languageCode ? mb_strtoupper($languageCode) : null; - return $this->get("languages.{$language}") ?: (current($this->get('languages', [])) ?: null); + return $this->get("languages.{$languageCode}") ?: (current($this->get('languages', [])) ?: null); } /** @@ -340,13 +340,13 @@ public function getTranslations() /** * Get the translation. * - * @param string|null $language + * @param string|null $languageCode * * @return array */ - public function getTranslation($language = null) + public function getTranslation($languageCode = null) { - return $this->getTranslations()[$language] ?? current($this->getTranslations()); + return $this->getTranslations()[$languageCode] ?? current($this->getTranslations()); } /**