IntegerArray   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A filterValue() 0 8 2
1
<?php
2
/**
3
 * Spiral, Core Components
4
 *
5
 * @author Wolfy-J
6
 */
7
8
namespace Spiral\ODM\Accessors;
9
10
/**
11
 * Allows to store only integer values.
12
 *
13
 * Attention, array will be saved as one big $set operation in case when multiple atomic
14
 * operations applied to it (not supported by Mongo).
15
 */
16
class IntegerArray extends AbstractArray
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected function filterValue($value)
22
    {
23
        if (!is_numeric($value)) {
24
            return null;
25
        }
26
27
        return intval($value);
28
    }
29
}