Completed
Push — master ( 8f5bc0...179bc9 )
by WEBEWEB
03:06
created

NumberHelper::isNumber()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
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\Argument;
13
14
use WBW\Library\Core\Exception\Argument\NumberArgumentException;
15
16
/**
17
 * Number helper.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Core\Argument
21
 */
22
class NumberHelper {
23
24
    /**
25
     * Determines if a value is a number.
26
     *
27
     * @param mixed $value The value.
28
     * @throws NumberArgumentException Throws a Number argument exception if the value is not of expected type.
29
     */
30
    public static function isNumber($value) {
31
        if (false === is_numeric($value)) {
32
            throw new NumberArgumentException($value);
33
        }
34
    }
35
36
}
37