Completed
Push — master ( 44b4d6...c54f73 )
by WEBEWEB
06:15
created

DoubleHelper::parseString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2018 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\Helper\Argument;
13
14
use WBW\Library\Core\Exception\Argument\DoubleArgumentException;
15
use WBW\Library\Core\Exception\Argument\FloatArgumentException;
16
17
/**
18
 * Double helper.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Library\Core\Helper\Argument
22
 */
23
class DoubleHelper {
24
25
    /**
26
     * Parse a string.
27
     *
28
     * @param string $value The string value.
29
     * @return double Returns the double represented by the string value.
30
     * @throws DoubleArgumentException Throws a double argument exception if the string value does not represent a double.
31
     */
32
    public static function parseString($value) {
33
        try {
34
            return FloatHelper::parseString($value);
35
        } catch (FloatArgumentException $ex) {
36
            throw new DoubleArgumentException($value, $ex);
37
        }
38
    }
39
40
}
41