RemovesUnwantedParams::removeUnwantedParams()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 6
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 11
rs 10
1
<?php
2
3
namespace Sarahman\HttpRequestApiLog\Traits;
4
5
trait RemovesUnwantedParams
6
{
7
    private $unwantedKeys = ['password'];
8
9
    private function removeUnwantedParams(array &$params = [])
10
    {
11
        foreach ($params as $key => &$value) {
12
            if (in_array($key, $this->unwantedKeys, true)) {
13
                unset($params[$key]);
14
            } elseif (is_array($value)) {
15
                $this->removeUnwantedParams($value);
16
            }
17
        }
18
19
        return $params;
20
    }
21
}
22