RemovesUnwantedParams   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A removeUnwantedParams() 0 11 4
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