From 3246a37c63617c8d67ccea45f74c8866e4e26a7e Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Mon, 12 Sep 2022 23:51:25 +0200 Subject: [PATCH] Add simpler to use function check_is_translatable to autotranslater --- src/NodaTimeAutotranslater.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/NodaTimeAutotranslater.php b/src/NodaTimeAutotranslater.php index 11ac318..4a447c6 100644 --- a/src/NodaTimeAutotranslater.php +++ b/src/NodaTimeAutotranslater.php @@ -37,6 +37,26 @@ final class NodaTimeAutotranslater { * @return string */ + /** + * Checks if a time is translatable and returns an appropriate bool for easier + * interfacing than through self::check_translatability. + * + * @param string $zeit_beginn Beginn year. + * @param string $zeit_ende End year. + * @param string $zeit_zaehlzeit_monat Counting time month. + * + * @return boolean + */ + public function check_is_translatable(string $zeit_beginn, string $zeit_ende, string $zeit_zaehlzeit_monat):bool { + + if (self::check_translatability($zeit_beginn, $zeit_ende, $zeit_zaehlzeit_monat) === NodaTimeAutotranslaterStatus::NOT) { + return false; + } + + return true; + + } + /** * Checks if a time is translatable. * Translatable times have either a counting time day and month or at least a month.