Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Code Lines | 37 |
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 |
||
81 | public function getValidationConstraints(): Assert\Collection |
||
82 | { |
||
83 | return new Assert\Collection([ |
||
84 | 'token' => new Assert\Required([ |
||
85 | new Assert\NotBlank(), |
||
86 | ]), |
||
87 | 'name' => new Assert\Required([ |
||
88 | new Assert\NotBlank(), |
||
89 | ]), |
||
90 | 'signing_purpose' => new Assert\Optional([ |
||
91 | new Assert\NotBlank(), |
||
92 | new Assert\Choice([ |
||
93 | 'choices' => SigningPurposeProvider::getAllSigningPurposes(), |
||
94 | ]), |
||
95 | ]), |
||
96 | 'pdf' => new Assert\Optional([ |
||
97 | new Assert\NotBlank(), |
||
98 | new Assert\Collection([ |
||
99 | 'annotation' => new Assert\Optional([ |
||
100 | new Assert\NotBlank(), |
||
101 | new Assert\Collection([ |
||
102 | 'page' => new Assert\Optional([ |
||
103 | new Assert\NotBlank(), |
||
104 | new Assert\Type([ |
||
105 | 'type' => 'numeric', |
||
106 | ]), |
||
107 | ]), |
||
108 | 'top' => new Assert\Optional([ |
||
109 | new Assert\NotBlank(), |
||
110 | new Assert\Type([ |
||
111 | 'type' => 'numeric', |
||
112 | ]), |
||
113 | ]), |
||
114 | 'left' => new Assert\Optional([ |
||
115 | new Assert\NotBlank(), |
||
116 | new Assert\Type([ |
||
117 | 'type' => 'numeric', |
||
118 | ]) |
||
119 | ]), |
||
120 | 'width' => new Assert\Optional([ |
||
121 | new Assert\NotBlank(), |
||
122 | new Assert\Type([ |
||
123 | 'type' => 'numeric', |
||
124 | ]) |
||
125 | ]), |
||
126 | 'height' => new Assert\Optional([ |
||
127 | new Assert\NotBlank(), |
||
128 | new Assert\Type([ |
||
129 | 'type' => 'numeric', |
||
130 | ]) |
||
131 | ]), |
||
132 | 'text' => new Assert\Optional([ |
||
133 | new Assert\NotBlank(), |
||
134 | ]), |
||
169 |