Completed
Branch master (69a8ae)
by Roman
02:48
created

InvalidNotSameValueException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 14
ccs 11
cts 11
cp 1
rs 9.4285
cc 2
eloc 8
nc 2
nop 2
crap 2
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 InvalidNotSameValueException extends ArgumentException
11
{
12
    /**
13
     * @param string                        $variableName
14
     * @param int|float|bool|resource|array $variableValue
15
     * @throws InvalidNotEmptyException
16
     * @throws InvalidNotIntException
17
     * @throws InvalidNotStringException
18
     * @throws InvalidStringException
19
     */
20 4
    public function __construct($variableName, $variableValue)
21
    {
22 4
        if (!is_string($variableName)) {
23 1
            throw new InvalidStringException('variableName', $variableName);
24
        }
25
26 3
        parent::__construct(
27 3
            sprintf(
28 3
                'Variable "$%s" must be not same as: "%s"',
29 3
                $variableName,
30 3
                print_r($variableValue, true)
31 3
            )
32 3
        );
33 3
    }
34
}
35