GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#57)
by TJ
02:43
created

FiltersData   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A filterKeys() 0 5 1
A filter() 0 12 3
1
<?php
2
3
namespace Honeybadger\Concerns;
4
5
use Honeybadger\Support\Arr;
6
7
trait FiltersData
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $keysToFilter = [];
13
14
    /**
15
     * @param  array  $keysToFilter
16
     * @return mixed
17
     */
18
    public function filterKeys(array $keysToFilter) : self
19
    {
20
        $this->keysToFilter = array_merge($this->keysToFilter, $keysToFilter);
21
22
        return $this;
23
    }
24
25
    /**
26
     * @param  array  $values
27
     * @return array
28
     */
29
    private function filter(array $values) : array
30
    {
31
        return Arr::mapWithKeys($values, function ($value, $key) {
32
            if (is_array($value)) {
33
                return $this->filter($value);
34
            }
35
36
            if (in_array($key, $this->keysToFilter)) {
37
                return '[FILTERED]';
38
            }
39
40
            return $value;
41
        });
42
    }
43
}
44