@@ -33,33 +33,31 @@ public function fromRfc8941(Stringable|string $httpValue): StructuredField
33
33
/**
34
34
* @throws StructuredFieldError
35
35
*/
36
- public function toRfc9651 ( iterable $ data ): string
36
+ public function parse ( Stringable | string $ httpValue , ? Ietf $ rfc = null ): StructuredField
37
37
{
38
- return $ this ->serialize ($ data , Ietf::Rfc9651);
38
+ return match ($ this ) {
39
+ self ::List => OuterList::fromHttpValue ($ httpValue , $ rfc ),
40
+ self ::InnerList => InnerList::fromHttpValue ($ httpValue , $ rfc ),
41
+ self ::Parameters => Parameters::fromHttpValue ($ httpValue , $ rfc ),
42
+ self ::Dictionary => Dictionary::fromHttpValue ($ httpValue , $ rfc ),
43
+ self ::Item => Item::fromHttpValue ($ httpValue , $ rfc ),
44
+ };
39
45
}
40
46
41
47
/**
42
48
* @throws StructuredFieldError
43
49
*/
44
- public function toRfc8941 (iterable $ data ): string
50
+ public function toRfc9651 (iterable $ data ): string
45
51
{
46
- return $ this ->serialize ($ data , Ietf::Rfc8941 );
52
+ return $ this ->serialize ($ data , Ietf::Rfc9651 );
47
53
}
48
54
49
55
/**
50
56
* @throws StructuredFieldError
51
57
*/
52
- public function parse ( Stringable | string $ httpValue , ? Ietf $ rfc = null ): StructuredField
58
+ public function toRfc8941 ( iterable $ data ): string
53
59
{
54
- $ parser = new Parser ($ rfc );
55
-
56
- return match ($ this ) {
57
- self ::List => OuterList::fromHttpValue ($ httpValue , $ parser ),
58
- self ::InnerList => InnerList::fromHttpValue ($ httpValue , $ parser ),
59
- self ::Parameters => Parameters::fromHttpValue ($ httpValue , $ parser ),
60
- self ::Dictionary => Dictionary::fromHttpValue ($ httpValue , $ parser ),
61
- self ::Item => Item::fromHttpValue ($ httpValue , $ parser ),
62
- };
60
+ return $ this ->serialize ($ data , Ietf::Rfc8941);
63
61
}
64
62
65
63
/**
@@ -83,17 +81,4 @@ public function create(iterable $data): StructuredField
83
81
self ::Item => Item::fromPair ([...$ data ]), /* @phpstan-ignore-line */
84
82
};
85
83
}
86
-
87
- /**
88
- * DEPRECATION WARNING! This method will be removed in the next major point release.
89
- *
90
- * @deprecated Since version 1.3.0
91
- * @codeCoverageIgnore
92
- *
93
- * @see DataType::serialize()
94
- */
95
- public function build (iterable $ data , ?Ietf $ rfc = null ): string
96
- {
97
- return $ this ->serialize ($ data , $ rfc );
98
- }
99
84
}
0 commit comments