Skip to content

Commit

Permalink
Simplify DataType codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 25, 2023
1 parent 592d402 commit eb5bfa8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/DataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public function parse(Stringable|string $httpValue): StructuredField
*/
public function build(iterable $data): string
{
return match ($this) {
self::Dictionary => Dictionary::fromPairs($data)->toHttpValue(),
self::Parameters => Parameters::fromPairs($data)->toHttpValue(),
self::List => OuterList::fromPairs($data)->toHttpValue(),
self::InnerList => InnerList::fromPair([...$data])->toHttpValue(), /* @phpstan-ignore-line */
self::Item => Item::fromPair([...$data])->toHttpValue(), /* @phpstan-ignore-line */
};
return (match ($this) {
self::Dictionary => Dictionary::fromPairs($data),
self::Parameters => Parameters::fromPairs($data),
self::List => OuterList::fromPairs($data),
self::InnerList => InnerList::fromPair([...$data]), /* @phpstan-ignore-line */
self::Item => Item::fromPair([...$data]), /* @phpstan-ignore-line */
})->toHttpValue();
}
}

0 comments on commit eb5bfa8

Please sign in to comment.