Conditions | 1 |
Paths | 1 |
Total Lines | 117 |
Code Lines | 73 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
36 | public static function defineFontStyles(PhpWord $phpWord) : void |
||
37 | { |
||
38 | $phpWord->addFontStyle( |
||
39 | self::FONT_STYLE_TITLE, |
||
40 | [ |
||
41 | 'name' => self::FONT_FAMILY, |
||
42 | 'size' => 11, |
||
43 | 'bold' => true, |
||
44 | ] |
||
45 | ); |
||
46 | $phpWord->addFontStyle( |
||
47 | self::FONT_STYLE_HEADING_RECEIPT, |
||
48 | [ |
||
49 | 'name' => self::FONT_FAMILY, |
||
50 | 'size' => 6, |
||
51 | 'bold' => true, |
||
52 | ], |
||
53 | [ |
||
54 | 'spacing' => Converter::pointToTwip(9), |
||
55 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
56 | 'spaceAfter' => 0, |
||
57 | ] |
||
58 | ); |
||
59 | $phpWord->addFontStyle( |
||
60 | self::FONT_STYLE_VALUE_RECEIPT, |
||
61 | [ |
||
62 | 'name' => self::FONT_FAMILY, |
||
63 | 'size' => 8, |
||
64 | ], |
||
65 | [ |
||
66 | 'spacing' => Converter::pointToTwip(9), |
||
67 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
68 | 'spaceAfter' => 0, |
||
69 | ] |
||
70 | ); |
||
71 | $phpWord->addFontStyle( |
||
72 | self::FONT_STYLE_AMOUNT_RECEIPT, |
||
73 | [ |
||
74 | 'name' => self::FONT_FAMILY, |
||
75 | 'size' => 8, |
||
76 | ], |
||
77 | [ |
||
78 | 'spacing' => Converter::pointToTwip(11), |
||
79 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
80 | 'spaceAfter' => 0, |
||
81 | ] |
||
82 | ); |
||
83 | $phpWord->addFontStyle( |
||
84 | self::FONT_STYLE_ACCEPTANCE_POINT, |
||
85 | [ |
||
86 | 'name' => self::FONT_FAMILY, |
||
87 | 'size' => 6, |
||
88 | 'bold' => true, |
||
89 | ], |
||
90 | [ |
||
91 | 'spacing' => Converter::pointToTwip(8), |
||
92 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
93 | 'spaceAfter' => 0, |
||
94 | 'alignment' => Jc::END, |
||
95 | ] |
||
96 | ); |
||
97 | $phpWord->addFontStyle( |
||
98 | self::FONT_STYLE_HEADING_PAYMENT_PART, |
||
99 | [ |
||
100 | 'name' => self::FONT_FAMILY, |
||
101 | 'size' => 8, |
||
102 | 'bold' => true, |
||
103 | ], |
||
104 | [ |
||
105 | 'spacing' => Converter::pointToTwip(11), |
||
106 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
107 | 'spaceAfter' => 0, |
||
108 | ] |
||
109 | ); |
||
110 | $phpWord->addFontStyle( |
||
111 | self::FONT_STYLE_VALUE_PAYMENT_PART, |
||
112 | [ |
||
113 | 'name' => self::FONT_FAMILY, |
||
114 | 'size' => 10, |
||
115 | ], |
||
116 | [ |
||
117 | 'spacing' => Converter::pointToTwip(11), |
||
118 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
119 | 'spaceAfter' => 0, |
||
120 | ] |
||
121 | ); |
||
122 | $phpWord->addFontStyle( |
||
123 | self::FONT_STYLE_AMOUNT_PAYMENT_PART, |
||
124 | [ |
||
125 | 'name' => self::FONT_FAMILY, |
||
126 | 'size' => 10, |
||
127 | ], |
||
128 | [ |
||
129 | 'spacing' => Converter::pointToTwip(13), |
||
130 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
131 | 'spaceAfter' => 0, |
||
132 | ] |
||
133 | ); |
||
134 | |||
135 | $fontStyle = [ |
||
136 | 'name' => self::FONT_FAMILY, |
||
137 | 'size' => 7, |
||
138 | ]; |
||
139 | $paragraphStyle = [ |
||
140 | 'spacing' => Converter::pointToTwip(8), |
||
141 | 'spacingLineRule' => LineSpacingRule::EXACT, |
||
142 | 'spaceAfter' => 0, |
||
143 | ]; |
||
144 | $phpWord->addFontStyle( |
||
145 | self::FONT_STYLE_FURTHER_INFORMATION_PAYMENT_PART, |
||
146 | $fontStyle, |
||
147 | $paragraphStyle |
||
148 | ); |
||
149 | $phpWord->addFontStyle( |
||
150 | self::FONT_STYLE_SEPARATOR, |
||
151 | $fontStyle, |
||
152 | array_merge($paragraphStyle, ['alignment' => Jc::CENTER]), |
||
153 | ); |
||
156 |