diff options
author | Hamid Dehnavi <hamid.dev.pro@gmail.com> | 2023-07-07 04:54:20 +0330 |
---|---|---|
committer | Hamid Dehnavi <hamid.dev.pro@gmail.com> | 2023-07-07 04:54:20 +0330 |
commit | d0b20534b94d0295472ab22157a2bc4c2c9fb703 (patch) | |
tree | 11778f60be448d4a2eb9e0d66d2cd1a164898c01 /lib/private/DateTimeFormatter.php | |
parent | 56402460121080cb0d63e4c4d4ec51e5b409fed2 (diff) | |
download | nextcloud-server-d0b20534b94d0295472ab22157a2bc4c2c9fb703.tar.gz nextcloud-server-d0b20534b94d0295472ab22157a2bc4c2c9fb703.zip |
Refactor "substr" calls to improve code readability
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
Diffstat (limited to 'lib/private/DateTimeFormatter.php')
-rw-r--r-- | lib/private/DateTimeFormatter.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php index 1c8b4f6d3ab..906b7ddf6dc 100644 --- a/lib/private/DateTimeFormatter.php +++ b/lib/private/DateTimeFormatter.php @@ -125,7 +125,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { * @return string Formatted relative date string */ public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) { - if (substr($format, -1) !== '*' && substr($format, -1) !== '*') { + if (!str_ends_with($format, '*') && !str_ends_with($format, '*')) { $format .= '^'; } @@ -289,7 +289,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { * @return string Formatted relative date and time string */ public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) { - if (substr($formatDate, -1) !== '^' && substr($formatDate, -1) !== '*') { + if (!str_ends_with($formatDate, '^') && !str_ends_with($formatDate, '*')) { $formatDate .= '^'; } |