Skip to content

Commit df88b47

Browse files
authored
Merge pull request #175 from codebar-ag/feature-styles
Feature Styles
2 parents 8fcbb50 + c50ce7d commit df88b47

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)