Completed
Push — implicit-property ( 7848fa )
by Michael
11:42
created

InternalAnnotations::createMetadata()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 71
Code Lines 55

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 55
dl 0
loc 71
rs 8.9818
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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\Implicit;
11
use Doctrine\Annotations\Annotation\Target;
12
13
/**
14
 * Internal meta-annotations exposed by the Annotations library to declare custom user-land annotations.
15
 *
16
 * @internal
17
 */
18
final class InternalAnnotations
19
{
20
    public static function createMetadata() : MetadataCollection
21
    {
22
        return new TransientMetadataCollection(
23
            new AnnotationMetadata(
24
                Attribute::class,
25
                AnnotationTarget::annotation(),
26
                false,
27
                new PropertyMetadata(
28
                    'name',
29
                    ['type' => 'string'],
30
                    true,
31
                    true
32
                ),
33
                new PropertyMetadata(
34
                    'type',
35
                    ['type' => 'string'],
36
                    true
37
                ),
38
                new PropertyMetadata(
39
                    'required',
40
                    ['type' => 'boolean']
41
                )
42
            ),
43
            new AnnotationMetadata(
44
                Attributes::class,
45
                AnnotationTarget::class(),
46
                false,
47
                new PropertyMetadata(
48
                    'value',
49
                    [
50
                        'type'       => 'array',
51
                        'array_type' =>Attribute::class,
52
                        'value'      =>'array<' . Attribute::class . '>',
53
                    ],
54
                    true,
55
                    true
56
                )
57
            ),
58
            new AnnotationMetadata(
59
                Enum::class,
60
                AnnotationTarget::property(),
61
                true,
62
                new PropertyMetadata(
63
                    'value',
64
                    ['type' => 'array'],
65
                    true,
66
                    true
67
                ),
68
                new PropertyMetadata(
69
                    'literal',
70
                    ['type' => 'array']
71
                )
72
            ),
73
            new AnnotationMetadata(
74
                Implicit::class,
75
                AnnotationTarget::property(),
76
                false
77
            ),
78
            new AnnotationMetadata(
79
                Target::class,
80
                AnnotationTarget::class(),
81
                true,
82
                new PropertyMetadata(
83
                    'value',
84
                    [
85
                        'type'      =>'array',
86
                        'array_type'=>'string',
87
                        'value'     =>'array<string>',
88
                    ],
89
                    false,
90
                    true
91
                )
92
            )
93
        );
94
    }
95
}
96