diff --git a/src/NodaTimeAutotranslater.php b/src/NodaTimeAutotranslater.php index 9c9e805..0f4d416 100644 --- a/src/NodaTimeAutotranslater.php +++ b/src/NodaTimeAutotranslater.php @@ -10,7 +10,7 @@ require_once __DIR__ . '/inc/datesByCountry.php'; /** * Autotranslater class for times. */ -class NodaTimeAutotranslater { +final class NodaTimeAutotranslater { const USECASE_MONTH = 1; const USECASE_DAY = 2; @@ -74,11 +74,11 @@ class NodaTimeAutotranslater { */ public function translate(array $timeInfo):void { - if (!self::check_translatability($timeInfo['zeit_zaehlzeit_monat'])) { + if (!self::check_translatability((string)$timeInfo['zeit_zaehlzeit_monat'])) { throw new MDgenericInvalidInputsException("Non-translatable date"); } - if (trim($timeInfo['zeit_zaehlzeit_tag'], ", .0") === "") { + if (trim((string)$timeInfo['zeit_zaehlzeit_tag'], ", .0") === "") { $dateStr = "{$timeInfo['zeit_zaehlzeit_jahr']}-{$timeInfo['zeit_zaehlzeit_monat']}-05 00:00:01"; $usecase = self::USECASE_MONTH; } @@ -94,7 +94,10 @@ class NodaTimeAutotranslater { setlocale(LC_TIME, $locale); if ($locale !== setlocale(LC_TIME, "0")) continue; if ($usecase === self::USECASE_MONTH) $tLangValue = strftime(getMonthFormatByLang($tLang), $dateGeneral ?: 0); - else if ($usecase === self::USECASE_DAY) $tLangValue = strftime(getDateFormatByLang($tLang), $dateGeneral ?: 0); + else { # if ($usecase === self::USECASE_DAY) + $tLangValue = strftime(getDateFormatByLang($tLang), $dateGeneral ?: 0); + } + $this->_insertStmt->bind_param("iss", $this->_znum, $tLang, $tLangValue); $this->_insertStmt->execute(); diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index db2326d..ab00861 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -173,7 +173,7 @@ final class NodaTimeSplitter { } else if ($moda[0] === $moda[1] && trim($moda[2], " 0") !== "" && trim($moda[3], " 0") === "") { setlocale(LC_TIME, NodaTimeAutotranslater::LANGS_TO_LOCALES['de']); - return strftime(getMonthFormatByLang("de"), strtotime("{$moda[0]}-{$moda[2]}-01 01:01:01")); + return strftime(getMonthFormatByLang("de"), MD_STD::strtotime("{$moda[0]}-{$moda[2]}-01 01:01:01")); } return "";