Completed
Push — master ( 06117a...d54351 )
by Rafael
03:01
created

FloatParser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseValue() 0 8 3
1
<?php
2
3
/**
4
 * LICENSE: This file is subject to the terms and conditions defined in
5
 * file 'LICENSE', which is part of this source code package.
6
 *
7
 * @copyright 2016 Copyright(c) - All rights reserved.
8
 */
9
10
namespace Rafrsr\LibArray2Object\Parser;
11
12
class FloatParser implements ValueParserInterface
13
{
14
    /**
15
     * @inheritDoc
16
     */
17
    public function parseValue($value, $type, \ReflectionProperty $property, $object)
18
    {
19
        if ($type === 'float' || $type === 'double') {
20
            return (float)$value;
21
        }
22
23
        return $value;
24
    }
25
}