Alnum   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 19
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 5 1
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\Filter\Rule\Sanitize;
10
11
/**
12
 *
13
 * Strips non-alphanumeric characters from the value.
14
 *
15
 * @package Aura.Filter
16
 *
17
 */
18
class Alnum
19
{
20
    /**
21
     *
22
     * Strips non-alphanumeric characters from the value.
23
     *
24
     * @param object $subject The subject to be filtered.
25
     *
26
     * @param string $field The subject field name.
27
     *
28
     * @return bool Always true.
29
     *
30
     */
31 2
    public function __invoke($subject, $field)
32
    {
33 2
        $subject->$field = preg_replace('/[^\p{L}\p{Nd}]/u', '', $subject->$field);
34 2
        return true;
35
    }
36
}
37