Completed
Push — master ( 379576...3184a2 )
by Roman
02:29
created

NumberNotLessException   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 29
ccs 15
cts 15
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 19 6
1
<?php
2
/**
3
 * @link      https://github.com/ko-ko-ko/php-assert
4
 * @copyright Copyright (c) 2015 Roman Levishchenko <[email protected]>
5
 * @license   https://raw.github.com/ko-ko-ko/php-assert/master/LICENSE
6
 */
7
8
namespace KoKoKo\assert\exceptions;
9
10
class NumberNotLessException extends ArgumentException
11
{
12
    /**
13
     * @param string    $variableName
14
     * @param int|float $variableValue
15
     * @param int|float $number
16
     * @throws InvalidIntOrFloatException
17
     * @throws InvalidStringException
18
     */
19 6
    public function __construct($variableName, $variableValue, $number)
20
    {
21 6
        if (!is_string($variableName)) {
22 1
            throw new InvalidStringException('variableName', $variableName);
23 5
        } elseif (!is_int($variableValue) && !is_float($variableValue)) {
24 1
            throw new InvalidIntOrFloatException('variableValue', $variableValue);
25 5
        } elseif (!is_int($number) && !is_float($number)) {
26 1
            throw new InvalidIntOrFloatException('number', $number);
27
        }
28
29 5
        parent::__construct(
30 5
            sprintf(
31 5
                'Variable "$%s" must be less than "%s", actual value: "%s"',
32 5
                $variableName,
33 5
                (string) $number,
34
                (string) $variableValue
35 5
            )
36 5
        );
37
    }
38
}