| 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 |
||
| 19 | 290 | public static function createMetadata() : MetadataCollection |
|
| 20 | { |
||
| 21 | 290 | return new TransientMetadataCollection( |
|
| 22 | 290 | new AnnotationMetadata( |
|
| 23 | 290 | Attribute::class, |
|
| 24 | 290 | AnnotationTarget::annotation(), |
|
| 25 | 290 | false, |
|
| 26 | 290 | new PropertyMetadata( |
|
| 27 | 290 | 'name', |
|
| 28 | 290 | ['type' => 'string'], |
|
| 29 | 290 | true, |
|
| 30 | 290 | true |
|
| 31 | ), |
||
| 32 | 290 | new PropertyMetadata( |
|
| 33 | 290 | 'type', |
|
| 34 | 290 | ['type' => 'string'], |
|
| 35 | 290 | true |
|
| 36 | ), |
||
| 37 | 290 | new PropertyMetadata( |
|
| 38 | 290 | 'required', |
|
| 39 | 290 | ['type' => 'boolean'] |
|
| 40 | ) |
||
| 41 | ), |
||
| 42 | 290 | new AnnotationMetadata( |
|
| 43 | 290 | Attributes::class, |
|
| 44 | 290 | AnnotationTarget::class(), |
|
| 45 | 290 | false, |
|
| 46 | 290 | new PropertyMetadata( |
|
| 47 | 290 | 'value', |
|
| 48 | [ |
||
| 49 | 290 | 'type' => 'array', |
|
| 50 | 'array_type' =>Attribute::class, |
||
| 51 | 'value' =>'array<' . Attribute::class . '>', |
||
| 52 | ], |
||
| 53 | 290 | true, |
|
| 54 | 290 | true |
|
| 55 | ) |
||
| 56 | ), |
||
| 57 | 290 | new AnnotationMetadata( |
|
| 58 | 290 | Enum::class, |
|
| 59 | 290 | AnnotationTarget::property(), |
|
| 60 | 290 | true, |
|
| 61 | 290 | new PropertyMetadata( |
|
| 62 | 290 | 'value', |
|
| 63 | 290 | ['type' => 'array'], |
|
| 64 | 290 | true, |
|
| 65 | 290 | true |
|
| 66 | ), |
||
| 67 | 290 | new PropertyMetadata( |
|
| 68 | 290 | 'literal', |
|
| 69 | 290 | ['type' => 'array'] |
|
| 70 | ) |
||
| 71 | ), |
||
| 72 | 290 | new AnnotationMetadata( |
|
| 73 | 290 | Target::class, |
|
| 74 | 290 | AnnotationTarget::class(), |
|
| 75 | 290 | true, |
|
| 76 | 290 | new PropertyMetadata( |
|
| 77 | 290 | 'value', |
|
| 78 | [ |
||
| 79 | 290 | 'type' =>'array', |
|
| 80 | 'array_type'=>'string', |
||
| 81 | 'value' =>'array<string>', |
||
| 82 | ], |
||
| 83 | 290 | false, |
|
| 84 | 290 | true |
|
| 85 | ) |
||
| 90 |