File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -127,10 +127,12 @@ public function toDateTime(mixed $value): Carbon|int|false
127127 */
128128 protected function convertLdapTimeToDateTime (string $ value ): DateTime |false
129129 {
130- return DateTime::createFromFormat (
131- str_contains ($ value , 'Z ' ) ? 'YmdHis\Z ' : 'YmdHisT ' ,
132- $ value
133- );
130+ 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 ' ,
134+ default => 'YmdHisT '
135+ }, $ value );
134136 }
135137
136138 /**
@@ -148,11 +150,10 @@ protected function convertDateTimeToLdapTime(DateTime $date): string
148150 */
149151 protected function convertWindowsTimeToDateTime (string $ value ): DateTime |false
150152 {
151- return DateTime::createFromFormat (
152- str_contains ($ value , '0Z ' ) ? 'YmdHis.0\Z ' : 'YmdHis.0T ' ,
153- $ value ,
154- new DateTimeZone ('UTC ' )
155- );
153+ return DateTime::createFromFormat (match (true ) {
154+ str_contains ($ value , '0Z ' ) => 'YmdHis.0\Z ' ,
155+ default => 'YmdHis.0T '
156+ }, $ value , new DateTimeZone ('UTC ' ));
156157 }
157158
158159 /**
You can’t perform that action at this time.
0 commit comments