Boolean   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 20
ccs 9
cts 10
cp 0.9
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 14 4
1
<?php
2
3
namespace Flying\Struct\Property;
4
5
/**
6
 * Structure property with boolean value
7
 */
8
class Boolean extends Property
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 161
    protected function normalize(&$value)
14
    {
15 161
        if (!parent::normalize($value)) {
16
            return false;
17
        }
18 161
        if ($value === null) {
19 31
            return true;
20
        }
21 160
        if (!is_scalar($value)) {
22 3
            $value = !empty($value);
23 3
        }
24 160
        $value = (boolean)$value;
25 160
        return true;
26
    }
27
}
28