TrimFilter::filter()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php namespace Arcanedev\Sanitizer\Filters;
2
3
use Arcanedev\Sanitizer\Contracts\Filterable;
4
5
/**
6
 * Class     TrimFilter
7
 *
8
 * @package  Arcanedev\Sanitizer\Filters
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class TrimFilter implements Filterable
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Trims the given string.
19
     *
20
     * @param  mixed  $value
21
     * @param  array  $options
22
     *
23
     * @return string|mixed
24
     */
25 45
    public function filter($value, array $options = [])
26
    {
27 45
        return is_string($value) ? trim($value) : $value;
28
    }
29
}
30