1 | <?php |
||
2 | |||
3 | namespace Cocur\Chain\Link; |
||
4 | |||
5 | /** |
||
6 | * Class ChangeKeyCase. |
||
7 | * |
||
8 | * @author Christoph Rosse |
||
9 | */ |
||
10 | trait ChangeKeyCase |
||
11 | { |
||
12 | /** |
||
13 | * Changes the case of all keys in an array. |
||
14 | * |
||
15 | * Changes all keys from lowercased or uppercased. Numbered indices are left as is. |
||
16 | * |
||
17 | * @param int $case either `CASE_UPPER` or `CASE_LOWER` (default) |
||
18 | * |
||
19 | * @return self |
||
20 | */ |
||
21 | 2 | public function changeKeyCase(int $case = CASE_LOWER): self |
|
22 | { |
||
23 | 2 | $this->array = array_change_key_case($this->array, $case); |
|
1 ignored issue
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
24 | |||
25 | 2 | return $this; |
|
26 | } |
||
27 | } |
||
28 |