Completed
Push — master ( ece0e5...b20eda )
by Peter
02:27
created

InvalidPointTypeException::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
/**
4
 * GpsLab component.
5
 *
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2016, Peter Gribanov
8
 * @license   http://opensource.org/licenses/MIT
9
 */
10
11
namespace GpsLab\Component\Interval\Exception;
12
13
class InvalidPointTypeException extends \InvalidArgumentException
14
{
15
    /**
16
     * @param string $expected_type
17
     * @param mixed $point
18
     *
19
     * @return self
20
     */
21
    public static function type($expected_type, $point)
22
    {
23
        return new static(sprintf(
24
            'The point value must be of "%s" type. Actual type is "%s".',
25
            $expected_type,
26
            gettype($point)
27
        ));
28
    }
29
30
    /**
31
     * @param string $expected_type
32
     * @param string $point
33
     *
34
     * @return self
35
     */
36 4
    public static function point($expected_type, $point)
37
    {
38 4
        return new static(sprintf(
39 4
            'The point value must be of "%s". Actual point value is "%s".',
40 4
            $expected_type,
41
            $point
42 4
        ));
43
    }
44
}
45