From 4854ec2ad8b66e219ed453728725cde4335d5bde Mon Sep 17 00:00:00 2001 From: Penobit <60283818+penobit@users.noreply.github.com> Date: Tue, 22 Mar 2022 02:14:41 +0430 Subject: [PATCH] static languages method --- src/GoogleTranslate.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GoogleTranslate.php b/src/GoogleTranslate.php index 7bdc36d..832cd3a 100644 --- a/src/GoogleTranslate.php +++ b/src/GoogleTranslate.php @@ -336,7 +336,7 @@ protected function isValidLocale(string $lang) : bool return (bool) preg_match('/^([a-z]{2})(-[A-Z]{2})?$/', $lang); } - public function getLanguages($assoc = false) { + public static function getLanguages($assoc = false) { $file = __DIR__.'/languages.json'; $contents = file_get_contents($file); $languages = json_decode($contents, $assoc); @@ -344,8 +344,8 @@ public function getLanguages($assoc = false) { return $languages; } - public function getLanguage(string $lang) { - $languages = $this->getLanguages(true); + public static function getLanguage(string $lang) { + $languages = static::getLanguages(true); return $languages[$lang] ?? null; }