Return an integer when checking time ID by stored rewrite

This commit is contained in:
Joshua Ramon Enslin 2024-01-30 00:25:50 +01:00
parent 09518a0a6e
commit 3c43a3f2d3
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -711,11 +711,11 @@ final class NodaIDGetter {
* @param string $lang Language to check in.
* @param string $name Name of the time to search for.
*
* @return array<integer>
* @return integer
*/
public static function getTimeIDByRewrite(MDMysqli $mysqli_noda, string $lang, string $name):array {
public static function getTimeIDByRewrite(MDMysqli $mysqli_noda, string $lang, string $name):int {
if (empty($name)) return [];
if (empty($name)) return 0;
$output = [];
@ -725,9 +725,10 @@ final class NodaIDGetter {
WHERE `language` = ?
AND `input_name` = ?", "ss", $lang, $name);
while ($timeRewriteData = $timeRewriteResult->fetch_row()) {
$output[] = $timeRewriteData[0];
if ($timeRewriteData = $timeRewriteResult->fetch_row()) {
$output = (int)$timeRewriteData[0];
}
else $output = 0;
$timeRewriteResult->close();
@ -943,7 +944,7 @@ final class NodaIDGetter {
}
if (!empty($timeIdByRewrite = self::getTimeIDByRewrite($mysqli_noda, $lang, $name))) {
return end($timeIdByRewrite);
return $timeIdByRewrite;
}
if ($instance !== "") {