@@ -57,39 +57,39 @@ unset($permissions['a']); // triggers a ForbiddenOperation exception
57
57
The ` Dictionary ` and ` Parameters ` classes also allow accessing its members as value using their key:
58
58
59
59
``` php
60
- $permissions->hasKey ('picture-in-picture'); // returns true
61
- $permissions->hasKey ('picture-in-picture', 'foobar'); // returns false
60
+ $permissions->hasName ('picture-in-picture'); // returns true
61
+ $permissions->hasName ('picture-in-picture', 'foobar'); // returns false
62
62
// 'foobar' is not a valid key or at least it is not present
63
63
64
- $permissions->getByKey ('camera'); // returns Item::fromToken('*');
64
+ $permissions->getByName ('camera'); // returns Item::fromToken('*');
65
65
$permissions->toAssociative(); // returns an iterator
66
66
// the iterator key is the member key and the value is the member value
67
67
// the offset is "lost"
68
- $permissions->keyByIndex (42); // returns null because there's no member with the offset 42
69
- $permissions->keyByIndex (2); // returns 'camera'
68
+ $permissions->nameByIndex (42); // returns null because there's no member with the offset 42
69
+ $permissions->nameByIndex (2); // returns 'camera'
70
70
71
- $permissions->indexByKey ('foobar'): // returns null because there's no member with the key 'foobar'
72
- $permissions->indexByKey ('geolocation'): // returns 1
71
+ $permissions->indexByName ('foobar'): // returns null because there's no member with the key 'foobar'
72
+ $permissions->indexByName ('geolocation'): // returns 1
73
73
```
74
74
75
75
> [ !IMPORTANT]
76
- > The ` getByKey ` method will throw an ` InvalidOffset ` exception if no member exists for the given ` $offset ` .
76
+ > The ` getByName ` method will throw an ` InvalidOffset ` exception if no member exists for the given ` $offset ` .
77
77
78
78
> [ !TIP]
79
79
> The ` ArrayAccess ` interface proxy the result from ` getByIndex ` in list.
80
- > The ` ArrayAccess ` interface proxy the result from ` getByKey ` in ordered map.
80
+ > The ` ArrayAccess ` interface proxy the result from ` getByName ` in ordered map.
81
81
82
82
### Accessing the parameters values
83
83
84
84
As we have already seen, it is possible to access the ` Parameters ` values directly
85
85
from the ` Item ` instance. The same public API is used from the ` InnerList ` .
86
86
87
87
On the other hand if you already have a ` Parameters ` instance you can use the
88
- ` valueByKey ` and ` valueByIndex ` methods to directly access the value from a single
88
+ ` valueByName ` and ` valueByIndex ` methods to directly access the value from a single
89
89
parameter.
90
90
91
91
> [ !TIP]
92
- > The ` parameterByKey ` proxy the result from ` valueByKey ` .
92
+ > The ` parameterByKey ` proxy the result from ` valueByName ` .
93
93
> The ` parameterByIndex ` proxy the result from ` valueByIndex ` .
94
94
95
95
## Building and Updating Structured Fields Values
@@ -138,11 +138,11 @@ following steps. You, first, create a `Parameters` or a `Dictionary` instance us
138
138
use any of the following modifying methods to populate it.
139
139
140
140
``` php
141
- $map->add(string $key , $value): static;
142
- $map->append(string $key , $value): static;
143
- $map->prepend(string $key , $value): static;
141
+ $map->add(string $name , $value): static;
142
+ $map->append(string $name , $value): static;
143
+ $map->prepend(string $name , $value): static;
144
144
$map->mergeAssociative(...$others): static;
145
- $map->removeByKeys(string ...$keys ): static;
145
+ $map->removeByKeys(string ...$names ): static;
146
146
```
147
147
148
148
As shown below:
@@ -384,9 +384,9 @@ Both objects provide additional modifying methods to help deal with parameters.
384
384
You can attach and update the associated ` Parameters ` instance using the following methods.
385
385
386
386
``` php
387
- $field->addParameter(string $key , mixed $value): static;
388
- $field->appendParameter(string $key , mixed $value): static;
389
- $field->prependParameter(string $key , mixed $value): static;
387
+ $field->addParameter(string $name , mixed $value): static;
388
+ $field->appendParameter(string $name , mixed $value): static;
389
+ $field->prependParameter(string $name , mixed $value): static;
390
390
$field->withoutParameters(string ...$keys): static; // this method is deprecated as of version 1.1 use withoutParametersByKeys instead
391
391
$field->withoutAnyParameter(): static;
392
392
$field->withParameters(Parameters $parameters): static;
0 commit comments