| 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 |
||
| 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 | ) |
||
| 88 |