| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 51 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 48 |
| CRAP Score | 1 |
| Changes | 0 | ||
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:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 27 | 278 | public static function createMetadata() : MetadataCollection |
|
| 28 | { |
||
| 29 | 278 | return new MetadataCollection( |
|
| 30 | 278 | new AnnotationMetadata( |
|
| 31 | 278 | Attribute::class, |
|
| 32 | 278 | AnnotationTarget::annotation(), |
|
| 33 | 278 | false, |
|
| 34 | 278 | new PropertyMetadata( |
|
| 35 | 278 | 'name', |
|
| 36 | 278 | ['type' => 'string'], |
|
| 37 | 278 | true, |
|
| 38 | 278 | true |
|
| 39 | ), |
||
| 40 | 278 | new PropertyMetadata( |
|
| 41 | 278 | 'type', |
|
| 42 | 278 | ['type' => 'string'], |
|
| 43 | 278 | true |
|
| 44 | ), |
||
| 45 | 278 | new PropertyMetadata( |
|
| 46 | 278 | 'required', |
|
| 47 | 278 | ['type' => 'boolean'] |
|
| 48 | ) |
||
| 49 | ), |
||
| 50 | 278 | new AnnotationMetadata( |
|
| 51 | 278 | Attributes::class, |
|
| 52 | 278 | AnnotationTarget::class(), |
|
| 53 | 278 | false, |
|
| 54 | 278 | new PropertyMetadata( |
|
| 55 | 278 | 'value', |
|
| 56 | [ |
||
| 57 | 278 | 'type' => 'array', |
|
| 58 | 'array_type' =>'Doctrine\Annotations\Annotation\Attribute', |
||
| 59 | 'value' =>'array<Doctrine\Annotations\Annotation\Attribute>', |
||
| 60 | ], |
||
| 61 | 278 | true, |
|
| 62 | 278 | true |
|
| 63 | ) |
||
| 64 | ), |
||
| 65 | 278 | new AnnotationMetadata( |
|
| 66 | 278 | Enum::class, |
|
| 67 | 278 | AnnotationTarget::property(), |
|
| 68 | 278 | true, |
|
| 69 | 278 | new PropertyMetadata( |
|
| 70 | 278 | 'value', |
|
| 71 | 278 | ['type' => 'array'], |
|
| 72 | 278 | true, |
|
| 73 | 278 | true |
|
| 74 | ), |
||
| 75 | 278 | new PropertyMetadata( |
|
| 76 | 278 | 'literal', |
|
| 77 | 278 | ['type' => 'array'] |
|
| 78 | ) |
||
| 79 | ), |
||
| 80 | 278 | new AnnotationMetadata( |
|
| 81 | 278 | Target::class, |
|
| 82 | 278 | AnnotationTarget::class(), |
|
| 83 | 278 | true, |
|
| 84 | 278 | new PropertyMetadata( |
|
| 85 | 278 | 'value', |
|
| 86 | [ |
||
| 87 | 278 | 'type' =>'array', |
|
| 88 | 'array_type'=>'string', |
||
| 89 | 'value' =>'array<string>', |
||
| 90 | ], |
||
| 91 | 278 | false, |
|
| 92 | 278 | true |
|
| 93 | ) |
||
| 98 |