BooleanType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A convertToModlrValue() 0 13 4
1
<?php
2
3
namespace As3\Modlr\DataTypes\Types;
4
5
/**
6
 * The boolean data type converter.
7
 *
8
 * @author Jacob Bare <[email protected]>
9
 */
10
class BooleanType implements TypeInterface
11
{
12
    /**
13
     * {@inheritDoc}
14
     */
15
    public function convertToModlrValue($value)
16
    {
17
        if (null === $value) {
18
            return $value;
19
        }
20
        if ('true' === strtolower($value)) {
21
            return true;
22
        }
23
        if ('false' === strtolower($value)) {
24
            return false;
25
        }
26
        return (Boolean) $value;
27
    }
28
}
29