| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 94 | 
| Code Lines | 63 | 
| 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 | ||
| 122 | public function getValidationConstraints(): Assert\Collection | ||
| 123 |     { | ||
| 124 | return new Assert\Collection([ | ||
| 125 | 'type' => new Assert\Required([ | ||
| 126 | new Assert\NotBlank(), | ||
| 127 | new Assert\Choice([ | ||
| 128 | 'choices' => DocumentTypeProvider::getAllDocumentTypes(), | ||
| 129 | ]), | ||
| 130 | ]), | ||
| 131 | 'name' => new Assert\Required([ | ||
| 132 | new Assert\NotBlank(), | ||
| 133 | ]), | ||
| 134 | 'files' => new Assert\Required([ | ||
| 135 | new Assert\NotBlank(), | ||
| 136 | new Assert\All([ | ||
| 137 | new Assert\Collection([ | ||
| 138 | 'token' => new Assert\Required([ | ||
| 139 | new Assert\NotBlank(), | ||
| 140 | ]), | ||
| 141 | 'type' => new Assert\Optional([ | ||
| 142 | new Assert\NotBlank(), | ||
| 143 | new Assert\Choice([ | ||
| 144 | 'choices' => [ | ||
| 145 | self::FILE_TYPE_MAIN, | ||
| 146 | self::FILE_TYPE_APPENDIX, | ||
| 147 | self::FILE_TYPE_ATTACHMENT, | ||
| 148 | ], | ||
| 149 | ]), | ||
| 150 | ]), | ||
| 151 | ]), | ||
| 152 | ]), | ||
| 153 | ]), | ||
| 154 | 'signers' => new Assert\Optional([ | ||
| 155 | new Assert\NotBlank(), | ||
| 156 | new Assert\All([ | ||
| 157 | new Assert\Collection([ | ||
| 158 | 'id' => new Assert\Required([ | ||
| 159 | new Assert\NotBlank(), | ||
| 160 | ]), | ||
| 161 | 'name' => new Assert\Required([ | ||
| 162 | new Assert\NotBlank(), | ||
| 163 | ]), | ||
| 164 | 'surname' => new Assert\Required([ | ||
| 165 | new Assert\NotBlank(), | ||
| 166 | ]), | ||
| 167 | 'code' => new Assert\Optional([ | ||
| 168 | new Assert\NotBlank(), | ||
| 169 | new MyAssert\Code(), | ||
| 170 | ]), | ||
| 171 | 'phone' => new Assert\Optional([ | ||
| 172 | new Assert\NotBlank(), | ||
| 173 | new MyAssert\Phone(), | ||
| 174 | ]), | ||
| 175 | 'company' => new Assert\Optional([ | ||
| 176 | new Assert\NotBlank(), | ||
| 177 | ]), | ||
| 178 | 'country' => new Assert\Optional([ | ||
| 179 | new Assert\NotBlank(), | ||
| 180 | ]), | ||
| 181 | 'country_code' => new Assert\Optional([ | ||
| 182 | new Assert\NotBlank(), | ||
| 183 | new Assert\Country(), | ||
| 184 | ]), | ||
| 185 | 'city' => new Assert\Optional([ | ||
| 186 | new Assert\NotBlank(), | ||
| 187 | ]), | ||
| 188 | 'postal_code' => new Assert\Optional([ | ||
| 189 | new Assert\NotBlank(), | ||
| 190 | ]), | ||
| 191 | 'position' => new Assert\Optional([ | ||
| 192 | new Assert\NotBlank(), | ||
| 193 | ]), | ||
| 194 | 'structural_subdivision' => new Assert\Optional([ | ||
| 195 | new Assert\NotBlank(), | ||
| 196 | ]), | ||
| 197 | 'signing_purpose' => new Assert\Optional([ | ||
| 198 | new Assert\NotBlank(), | ||
| 199 | new Assert\Choice([ | ||
| 200 | 'choices' => SigningPurposeProvider::getAllSigningPurposes(), | ||
| 201 | ]), | ||
| 202 | ]), | ||
| 203 | $this->type => new Assert\Optional(), | ||
| 204 | ]), | ||
| 205 | ]), | ||
| 206 | ]), | ||
| 207 | 'postback_url' => new Assert\Optional([ | ||
| 208 | new Assert\NotBlank(), | ||
| 209 | new Assert\Url(), | ||
| 210 | ]), | ||
| 211 | 'language' => new Assert\Optional([ | ||
| 212 | new Assert\NotBlank(), | ||
| 213 | new Assert\Language(), | ||
| 214 | ]), | ||
| 215 | $this->type => new Assert\Optional(), | ||
| 216 | ]); | ||
| 246 |