InvalidPointerException::nonexistentValue()   A
last analyzed

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
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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