Completed
Pull Request — master (#43)
by Rick
04:01 queued 20s
created

RemoveNull   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 17
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A filter() 0 8 2
1
<?php
2
/**
3
 * Particle.
4
 *
5
 * @link      http://github.com/particle-php for the canonical source repository
6
 * @copyright Copyright (c) 2005-2015 Particle (http://particle-php.com)
7
 * @license   https://github.com/particle-php/Filter/blob/master/LICENSE New BSD License
8
 */
9
namespace Particle\Filter\FilterRule;
10
11
use Particle\Filter\FilterResult;
12
use Particle\Filter\FilterRule;
13
14
/**
15
 * Class RemoveNull
16
 *
17
 * @package Particle\Filter\FilterRule
18
 */
19
class RemoveNull extends FilterRule
20
{
21
    /**
22
     * Returns an empty filter result if the value is null so the value can be removed.
23
     *
24
     * @param mixed $value
25
     * @return string
26
     */
27 5
    public function filter($value)
28
    {
29 5
        if ($value === null) {
30 1
            return new FilterResult(false);
31
        } else {
32 4
            return new FilterResult(true, $value);
33
        }
34
    }
35
}
36