Completed
Push — master ( 7942ad...1c8947 )
by WEBEWEB
01:50
created

DoubleUtility   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseString() 0 7 2
1
<?php
2
3
/**
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2017 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\Utility\Argument;
13
14
use WBW\Library\Core\Exception\Argument\DoubleArgumentException;
15
use WBW\Library\Core\Exception\Argument\FloatArgumentException;
16
17
/**
18
 * Double utility.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Library\Core\Utility\Argument
22
 * @final
23
 */
24
final class DoubleUtility {
25
26
    /**
27
     * Parse a string.
28
     *
29
     * @param string $value The string value.
30
     * @return double Returns the double represented by the string value.
31
     * @throws DoubleArgumentException Throws a double argument exception if the string value does not represent a double.
32
     */
33
    public static function parseString($value) {
34
        try {
35
            return FloatUtility::parseString($value);
36
        } catch (FloatArgumentException $ex) {
37
            throw new DoubleArgumentException($value, $ex);
38
        }
39
    }
40
41
}
42