From 0a6ec680ed544c7a23f08268177953c207ee05b0 Mon Sep 17 00:00:00 2001 From: aljawaid <10233708+aljawaid@users.noreply.github.com> Date: Fri, 12 May 2023 20:49:17 +0100 Subject: [PATCH] FIX: Code Syntax - PHP - `AgeHelper.php` --- Helper/AgeHelper.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Helper/AgeHelper.php b/Helper/AgeHelper.php index 5f5ae5d..8c8a4aa 100644 --- a/Helper/AgeHelper.php +++ b/Helper/AgeHelper.php @@ -33,15 +33,28 @@ public function newAge($timestamp, $now = null) // 86400s /day switch ($diff) { - case $diff < 60 : return ''. t('less than a minute ago') .''; - case $diff < 3600 : return ''. t('around %d minutes ago', $diff / 60) .''; // <1h - case $diff < 86400 : return ''. t('around %d hours ago', $diff / 3600) .''; // <24h - case $diff < 604800 : return ''. t('around %d days ago', $diff / 86400) .''; // <7D - case $diff < 2592000 : return ''. t('around %d weeks ago', $diff / 604800) .''; // <30D - case $diff < 31104000 : return ''. t('around %d months ago', $diff / 2592000) .''; // <360D - case $diff < 62208000 : return ''. t('over a year ago') .''; // <360D*2 + case $diff < 60: + return '' . t('less than a minute ago') .''; + case $diff < 3600: + // <1h + return '' . t('around %d minutes ago', $diff / 60) . ''; + case $diff < 86400: + // <24h + return '' . t('around %d hours ago', $diff / 3600) . ''; + case $diff < 604800: + // <7D + return '' . t('around %d days ago', $diff / 86400) . ''; + case $diff < 2592000: + // <30D + return '' . t('around %d weeks ago', $diff / 604800) . ''; + case $diff < 31104000: + // <360D + return '' . t('around %d months ago', $diff / 2592000) . ''; + case $diff < 62208000: + // <360D*2 + return '' . t('over a year ago') . ''; default: - return ''. t('over %d years ago' , $diff / 31104000) .''; + return '' . t('over %d years ago' , $diff / 31104000) . ''; } } }