| Conditions | 1 |
| Paths | 1 |
| Total Lines | 71 |
| Code Lines | 55 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 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 | ) |
||
| 96 |