ChangeKeyCase   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 16
ccs 3
cts 3
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeKeyCase() 0 5 1
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);
24
25 2
        return $this;
26
    }
27
}
28