| Conditions | 1 |
| Paths | 1 |
| Total Lines | 55 |
| Code Lines | 41 |
| 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 |
||
| 23 | public static function get(): AnnotationMetadata |
||
| 24 | { |
||
| 25 | return new AnnotationMetadata( |
||
| 26 | AnnotationWithVarType::class, |
||
| 27 | new AnnotationTarget(AnnotationTarget::TARGET_ALL), |
||
| 28 | false, |
||
| 29 | [ |
||
| 30 | new PropertyMetadata( |
||
| 31 | 'mixed', |
||
| 32 | new MixedType(), |
||
| 33 | true |
||
| 34 | ), |
||
| 35 | new PropertyMetadata( |
||
| 36 | 'boolean', |
||
| 37 | new BooleanType() |
||
| 38 | ), |
||
| 39 | new PropertyMetadata( |
||
| 40 | 'bool', |
||
| 41 | new BooleanType() |
||
| 42 | ), |
||
| 43 | new PropertyMetadata( |
||
| 44 | 'float', |
||
| 45 | new FloatType() |
||
| 46 | ), |
||
| 47 | new PropertyMetadata( |
||
| 48 | 'string', |
||
| 49 | new StringType() |
||
| 50 | ), |
||
| 51 | new PropertyMetadata( |
||
| 52 | 'integer', |
||
| 53 | new IntegerType() |
||
| 54 | ), |
||
| 55 | new PropertyMetadata( |
||
| 56 | 'array', |
||
| 57 | new ListType(new MixedType()) |
||
| 58 | ), |
||
| 59 | new PropertyMetadata( |
||
| 60 | 'arrayMap', |
||
| 61 | new MapType(new StringType(), new MixedType()) |
||
| 62 | ), |
||
| 63 | new PropertyMetadata( |
||
| 64 | 'annotation', |
||
| 65 | new ObjectType(AnnotationTargetAll::class) |
||
| 66 | ), |
||
| 67 | new PropertyMetadata( |
||
| 68 | 'arrayOfIntegers', |
||
| 69 | new ListType(new IntegerType()) |
||
| 70 | ), |
||
| 71 | new PropertyMetadata( |
||
| 72 | 'arrayOfStrings', |
||
| 73 | new ListType(new StringType()) |
||
| 74 | ), |
||
| 75 | new PropertyMetadata( |
||
| 76 | 'arrayOfAnnotations', |
||
| 77 | new ListType(new ObjectType(AnnotationTargetAll::class)) |
||
| 78 | ), |
||
| 83 |