File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,11 @@ public static function fromAssociative(iterable $members = []): self
101
101
*/
102
102
public static function fromPairs (Parameters |iterable $ pairs = []): self
103
103
{
104
- $ instance = new self ();
105
104
if ($ pairs instanceof Parameters) {
106
- $ pairs = $ pairs-> toPairs () ;
105
+ return clone $ pairs ;
107
106
}
108
107
108
+ $ instance = new self ();
109
109
foreach ($ pairs as [$ key , $ member ]) {
110
110
$ instance ->set ($ key , $ member );
111
111
}
@@ -124,6 +124,7 @@ public static function fromPairs(Parameters|iterable $pairs = []): self
124
124
public static function fromHttpValue (string $ httpValue ): self
125
125
{
126
126
$ instance = new self ();
127
+ $ httpValue = ltrim ($ httpValue , ' ' );
127
128
if ('' === $ httpValue ) {
128
129
return $ instance ;
129
130
}
Original file line number Diff line number Diff line change @@ -321,4 +321,15 @@ public function it_fails_to_parse_invalid_parameters_pairs(): void
321
321
322
322
Parameters::fromHttpValue (';foo = bar ' );
323
323
}
324
+
325
+ /**
326
+ * @test
327
+ */
328
+ public function it_successfully_parse_a_parameter_value_with_optional_white_spaces_in_front (): void
329
+ {
330
+ self ::assertEquals (
331
+ Parameters::fromHttpValue (';foo=bar ' ),
332
+ Parameters::fromHttpValue (' ;foo=bar ' )
333
+ );
334
+ }
324
335
}
You can’t perform that action at this time.
0 commit comments