Skip to content

Commit 6ce3ec1

Browse files
committed
Use str_ends_with
1 parent ec9a28c commit 6ce3ec1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Models/Attributes/Timestamp.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ public function toDateTime(mixed $value): Carbon|int|false
128128
protected function convertLdapTimeToDateTime(string $value): DateTime|false
129129
{
130130
return DateTime::createFromFormat(match (true) {
131-
str_contains($value, '.000Z') => 'YmdHis.000\Z',
132-
str_contains($value, '.0Z') => 'YmdHis.0\Z',
133-
str_contains($value, 'Z') => 'YmdHis\Z',
131+
str_ends_with($value, '000Z') => 'YmdHis.000\Z',
132+
str_ends_with($value, '0Z') => 'YmdHis.0\Z',
133+
str_ends_with($value, 'Z') => 'YmdHis\Z',
134134
default => 'YmdHisT',
135135
}, $value);
136136
}
@@ -153,7 +153,7 @@ protected function convertDateTimeToLdapTime(DateTime $date): string
153153
protected function convertWindowsTimeToDateTime(string $value): DateTime|false
154154
{
155155
return DateTime::createFromFormat(match (true) {
156-
str_contains($value, '.0Z') => 'YmdHis.0\Z',
156+
str_ends_with($value, '0Z') => 'YmdHis.0\Z',
157157
default => 'YmdHis.0T'
158158
}, $value, new DateTimeZone('UTC'));
159159
}

0 commit comments

Comments
 (0)