Conditions | 1 |
Paths | 1 |
Total Lines | 59 |
Code Lines | 42 |
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 |
||
59 | public function getValidationConstraints(): Assert\Collection |
||
60 | { |
||
61 | return new Assert\Collection([ |
||
62 | 'token' => new Assert\Required([ |
||
63 | new Assert\NotBlank(), |
||
64 | ]), |
||
65 | 'signers' => new Assert\Required([ |
||
66 | new Assert\NotBlank(), |
||
67 | new Assert\All([ |
||
68 | new Assert\Collection([ |
||
69 | 'id' => new Assert\Required([ |
||
70 | new Assert\NotBlank(), |
||
71 | ]), |
||
72 | 'name' => new Assert\Required([ |
||
73 | new Assert\NotBlank(), |
||
74 | ]), |
||
75 | 'surname' => new Assert\Required([ |
||
76 | new Assert\NotBlank(), |
||
77 | ]), |
||
78 | 'code' => new Assert\Optional([ |
||
79 | new Assert\NotBlank(), |
||
80 | new MyAssert\Code(), |
||
81 | ]), |
||
82 | 'phone' => new Assert\Optional([ |
||
83 | new Assert\NotBlank(), |
||
84 | new MyAssert\Phone(), |
||
85 | ]), |
||
86 | 'company' => new Assert\Optional([ |
||
87 | new Assert\NotBlank(), |
||
88 | ]), |
||
89 | 'country' => new Assert\Optional([ |
||
90 | new Assert\NotBlank(), |
||
91 | ]), |
||
92 | 'country_code' => new Assert\Optional([ |
||
93 | new Assert\NotBlank(), |
||
94 | new Assert\Country(), |
||
95 | ]), |
||
96 | 'city' => new Assert\Optional([ |
||
97 | new Assert\NotBlank(), |
||
98 | ]), |
||
99 | 'postal_code' => new Assert\Optional([ |
||
100 | new Assert\NotBlank(), |
||
101 | ]), |
||
102 | 'position' => new Assert\Optional([ |
||
103 | new Assert\NotBlank(), |
||
104 | ]), |
||
105 | 'structural_subdivision' => new Assert\Optional([ |
||
106 | new Assert\NotBlank(), |
||
107 | ]), |
||
108 | 'signing_purpose' => new Assert\Optional([ |
||
109 | new Assert\NotBlank(), |
||
110 | new Assert\Choice([ |
||
111 | 'choices' => SigningPurposeProvider::getAllSigningPurposes(), |
||
112 | ]), |
||
113 | ]), |
||
114 | 'pdf' => new Assert\Optional(), |
||
115 | 'pdflt' => new Assert\Optional(), |
||
116 | 'adoc' => new Assert\Optional(), |
||
117 | 'mdoc' => new Assert\Optional(), |
||
118 | ]), |
||
151 |