Basic::parseInput()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 12
ccs 7
cts 7
cp 1
crap 3
rs 10
1
<?php
2
3
namespace kalanis\kw_input\Parsers;
4
5
6
/**
7
 * Class Basic
8
 * @package kalanis\kw_input\Parsers
9
 * Parse any input for problematic chars
10
 */
11
class Basic extends AParser
12
{
13 5
    public function parseInput(array $input): array
14
    {
15 5
        $trimArray = [];
16 5
        foreach ($input as $key => $value) {
17 5
            if (is_array($value)) {
18 5
                $trimArray[$this->removeNullBytes($key)] = $this->parseInput($value);
19
            } else {
20 5
                $trimArray[$this->removeNullBytes($key)] = $this->removeNullBytes(trim(strval($value)));
21
            }
22
        }
23
        // @phpstan-ignore-next-line
24 5
        return $trimArray;
25
    }
26
}
27