ChangeKeyCase::changeKeyCase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
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