Passed
Pull Request — new-parser-ast-metadata (#3)
by
unknown
03:27
created

InvalidTarget   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 17
dl 0
loc 36
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A property() 0 6 1
A method() 0 6 1
A class() 0 6 1
A annotation() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Metadata;
6
7
use LogicException;
8
use function sprintf;
9
10
final class InvalidTarget extends LogicException implements ValidationException
11
{
12
    public static function class(AnnotationMetadata $metadata) : self
13
    {
14
        return new self(
15
            sprintf(
16
                'Class target is not allowed for annotation %s',
17
                $metadata->getName()
18
            )
19
        );
20
    }
21 1
    public static function property(AnnotationMetadata $metadata) : self
22
    {
23 1
        return new self(
24 1
            sprintf(
25 1
                'Property target is not allowed for annotation %s',
26 1
                $metadata->getName()
27
            )
28
        );
29
    }
30 1
    public static function method(AnnotationMetadata $metadata) : self
31
    {
32 1
        return new self(
33 1
            sprintf(
34 1
                'Method target is not allowed for annotation %s',
35 1
                $metadata->getName()
36
            )
37
        );
38
    }
39
40 3
    public static function annotation(AnnotationMetadata $metadata) : self
41
    {
42 3
        return new self(
43 3
            sprintf(
44 3
                'Annotation target is not allowed for annotation %s',
45 3
                $metadata->getName()
46
            )
47
        );
48
    }
49
}
50