Failed Conditions
Push — new-parser-ast-metadata ( 6127e0...5a4a16 )
by Michael
12s
created

ReferenceNotResolvable   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 16
dl 0
loc 31
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A unknownAlias() 0 7 2
A new() 0 7 2
A unknownImport() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Parser\Reference\Exception;
6
7
use Doctrine\Annotations\Parser\Ast\Reference;
8
use RuntimeException;
9
use function sprintf;
10
11
final class ReferenceNotResolvable extends RuntimeException implements ReferenceException
12
{
13 2
    public static function new(Reference $reference) : self
14
    {
15 2
        return new self(
16 2
            sprintf(
17 2
                '"%s%s" could not be resolved.',
18 2
                $reference->isFullyQualified() ? '\\' : '',
19 2
                $reference->getIdentifier()
20
            )
21
        );
22
    }
23
24 1
    public static function unknownImport(Reference $reference) : self
25
    {
26 1
        return new self(
27 1
            sprintf(
28 1
                '"%s%s" could not be resolved because referenced class was not imported.',
29 1
                $reference->isFullyQualified() ? '\\' : '',
30 1
                $reference->getIdentifier()
31
            )
32
        );
33
    }
34
35 6
    public static function unknownAlias(Reference $reference) : self
36
    {
37 6
        return new self(
38 6
            sprintf(
39 6
                '"%s%s" could not be resolved because referenced alias was not imported.',
40 6
                $reference->isFullyQualified() ? '\\' : '',
41 6
                $reference->getIdentifier()
42
            )
43
        );
44
    }
45
}
46