InvalidPointerException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 37
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidType() 0 4 1
A nonexistentValue() 0 8 1
A invalidTarget() 0 4 1
1
<?php
2
3
namespace League\JsonReference\Pointer;
4
5
final class InvalidPointerException extends \InvalidArgumentException
6
{
7
    /**
8
     * @param string $type
9
     *
10
     * @return static
11
     */
12 2
    public static function invalidType($type)
13
    {
14 2
        return new static(sprintf('Only strings are valid pointers, got "%s"', $type));
15
    }
16
17
    /**
18
     * @param string $value
19
     * @param string $pointer
20
     *
21
     * @return static
22
     */
23 6
    public static function nonexistentValue($value, $pointer)
24
    {
25 6
        return new static(sprintf(
26 6
            'The pointer "%1$s" referenced a value "%2$s" that does not exist.',
27 6
            $pointer,
28 3
            $value
29 3
        ));
30
    }
31
32
    /**
33
     * @param string $target
34
     *
35
     * @return static
36
     */
37 2
    public static function invalidTarget($target)
38
    {
39 2
        return new static(sprintf('Cannot set the value for %s because it is not within object or array', $target));
40
    }
41
}
42