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

InvalidPointTypeException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 32
ccs 5
cts 11
cp 0.4545
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A type() 0 8 1
A point() 0 8 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