@@ -448,6 +448,8 @@ $map->unshift(array ...$pairs): static;
448448$map->push(array ...$pairs): static;
449449$map->insert(int $key, array ...$pairs): static;
450450$map->replace(int $key, array $pair): static;
451+ $map->removeByKeys(string ...$keys): static;
452+ $map->removeByIndices(int ...$indices): static;
451453```
452454
453455We can rewrite the previous example
@@ -477,8 +479,8 @@ echo $value; //b=?0, a=(bar "42" 42 42.0), c=@1671800423
477479
478480** ⚠️WARNING: on duplicate ` keys ` pair values are merged as per RFC logic.**
479481
480- The ` remove ` always accepted string or integer as input. Since version ` 1.1 ` it will also remove
481- the corresponding pair if its index is given to the method.
482+ The ` remove ` always accepted string or integer as input. Since version ` 1.1 ` the method is fixed to
483+ remove the corresponding pair if its index is given to the method.
482484
483485``` diff
484486<?php
@@ -490,6 +492,16 @@ $field = Dictionary::fromHttpValue('b=?0, a=(bar "42" 42 42.0), c=@1671800423');
490492+ echo $field->remove('b', 2)->toHttpValue(); // returns a=(bar "42" 42 42.0)
491493```
492494
495+ If a stricter approach is needed, use the following new methods ` removeByIndices ` and/or ` removeByKeys ` :
496+
497+ ``` php
498+ use Bakame\Http\StructuredFields\Parameters;
499+
500+ $field = Parameters::fromHttpValue(';expire=@1681504328;path="/";max-age=2500;secure;httponly=?0;samesite=lax');
501+ echo $field->removeByIndices(4, 2, 0)->toHttpValue(); // returns ;path="/";secure;samesite=lax
502+ echo $field->removeByKeys('expire', 'httponly', 'max-age')->toHttpValue(); // returns ;path="/";secure;samesite=lax
503+ ```
504+
493505#### Automatic conversion
494506
495507For all containers, to ease instantiation the following automatic conversion are applied on
0 commit comments