Passed
Pull Request — master (#247)
by Michael
02:14
created

InternalAnnotations   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 52
dl 0
loc 68
ccs 48
cts 48
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createMetadata() 0 66 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Metadata;
6
7
use Doctrine\Annotations\Annotation\Attribute;
8
use Doctrine\Annotations\Annotation\Attributes;
9
use Doctrine\Annotations\Annotation\Enum;
10
use Doctrine\Annotations\Annotation\Target;
11
12
/**
13
 * @internal
14
 */
15
final class InternalAnnotations
16
{
17 290
    public static function createMetadata() : MetadataCollection
18
    {
19 290
        return new TransientMetadataCollection(
20 290
            new AnnotationMetadata(
21 290
                Attribute::class,
22 290
                AnnotationTarget::annotation(),
23 290
                false,
24 290
                new PropertyMetadata(
25 290
                    'name',
26 290
                    ['type' => 'string'],
27 290
                    true,
28 290
                    true
29
                ),
30 290
                new PropertyMetadata(
31 290
                    'type',
32 290
                    ['type' => 'string'],
33 290
                    true
34
                ),
35 290
                new PropertyMetadata(
36 290
                    'required',
37 290
                    ['type' => 'boolean']
38
                )
39
            ),
40 290
            new AnnotationMetadata(
41 290
                Attributes::class,
42 290
                AnnotationTarget::class(),
43 290
                false,
44 290
                new PropertyMetadata(
45 290
                    'value',
46
                    [
47 290
                        'type'       => 'array',
48
                        'array_type' =>Attribute::class,
49
                        'value'      =>'array<' . Attribute::class . '>',
50
                    ],
51 290
                    true,
52 290
                    true
53
                )
54
            ),
55 290
            new AnnotationMetadata(
56 290
                Enum::class,
57 290
                AnnotationTarget::property(),
58 290
                true,
59 290
                new PropertyMetadata(
60 290
                    'value',
61 290
                    ['type' => 'array'],
62 290
                    true,
63 290
                    true
64
                ),
65 290
                new PropertyMetadata(
66 290
                    'literal',
67 290
                    ['type' => 'array']
68
                )
69
            ),
70 290
            new AnnotationMetadata(
71 290
                Target::class,
72 290
                AnnotationTarget::class(),
73 290
                true,
74 290
                new PropertyMetadata(
75 290
                    'value',
76
                    [
77 290
                        'type'      =>'array',
78
                        'array_type'=>'string',
79
                        'value'     =>'array<string>',
80
                    ],
81 290
                    false,
82 290
                    true
83
                )
84
            )
85
        );
86
    }
87
}
88