From fe48055f82d2776e1ef1b917bbec2efa533c958b Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 26 Sep 2023 04:07:01 +0300 Subject: [PATCH] add localeKeyExists method #14 --- src/app/model/locale.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/model/locale.php b/src/app/model/locale.php index 812bb09..2334adb 100644 --- a/src/app/model/locale.php +++ b/src/app/model/locale.php @@ -19,6 +19,19 @@ class AppModelLocale { public function getLocales() : object { - return $this->_locales; + return (object) $this->_locales; + } + + public function localeKeyExists(string $key) : bool + { + foreach ($this->_locales as $locale) + { + if ($locale->key === $key) + { + return true; + } + } + + return false; } }