We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8fcbb50 + c50ce7d commit df88b47Copy full SHA for df88b47
src/DTO/Documents/DocumentIndex/IndexDetectDTO.php
@@ -0,0 +1,24 @@
1
+<?php
2
+
3
+namespace CodebarAg\DocuWare\DTO\Documents\DocumentIndex;
4
5
+use Illuminate\Support\Carbon;
6
7
+class IndexDetectDTO
8
+{
9
+ public function __construct(
10
+ public string $name,
11
+ public mixed $value,
12
+ ) {}
13
14
+ public static function make(string $name, mixed $value)
15
+ {
16
+ return match (true) {
17
+ is_string($value) => IndexTextDTO::make($name, $value),
18
+ is_int($value) => IndexNumericDTO::make($name, $value),
19
+ is_float($value) => IndexDecimalDTO::make($name, $value),
20
+ $value instanceof Carbon => IndexDateTimeDTO::make($name, $value),
21
+ default => null,
22
+ };
23
+ }
24
+}
0 commit comments