Completed
Push — master ( 0a7e57...033978 )
by Thomas Mauro
02:31
created

SanitizeDataProcessor   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 1 Features 2
Metric Value
wmc 7
c 3
b 1
f 2
lcom 0
cbo 1
dl 0
loc 25
ccs 0
cts 12
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B sanitize() 0 14 7
1
<?php
2
3
namespace Facile\SentryModule\Processor;
4
5
/**
6
 * Class SanitizeDataProcessor.
7
 */
8
class SanitizeDataProcessor extends \Raven_SanitizeDataProcessor
9
{
10
    /**
11
     * Replace any array values with our mask if the field name or the value matches a respective regex.
12
     *
13
     * @param mixed  $item Associative array value
14
     * @param string $key  Associative array key
15
     *
16
     * @return string
17
     */
18
    public function sanitize(&$item, $key)
19
    {
20
        if (null === $item
21
            || is_scalar($item)
22
            || (is_object($item) && method_exists($item, '__toString'))
23
        ) {
24
            $item = is_object($item) ? (string)$item : $item;
25
        } elseif (is_object($item)) {
26
            $item = '[object '.get_class($item).']';
27
        } else {
28
            $item = '['.gettype($item).']';
29
        }
30
        parent::sanitize($item, $key);
31
    }
32
}
33