Conditions | 1 |
Paths | 1 |
Total Lines | 79 |
Code Lines | 52 |
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 |
||
84 | public function provideTitles() |
||
85 | { |
||
86 | yield [ |
||
87 | IO::VERBOSITY_NORMAL, |
||
88 | false, |
||
89 | 50, |
||
90 | 'This is a title', |
||
91 | IO::VERBOSITY_NORMAL, |
||
92 | <<<'EOF' |
||
93 | |||
94 | This is a title |
||
95 | =============== |
||
96 | |||
97 | |||
98 | EOF |
||
99 | ]; |
||
100 | |||
101 | yield [ |
||
102 | IO::VERBOSITY_NORMAL, |
||
103 | true, |
||
104 | 50, |
||
105 | 'This is a title', |
||
106 | IO::VERBOSITY_NORMAL, |
||
107 | <<<'EOF' |
||
108 | [33m[0m |
||
109 | [0m[33mThis is a title[0m |
||
110 | [0m[33m===============[0m |
||
111 | [0m[33m[0m |
||
112 | [0m |
||
113 | EOF |
||
114 | ]; |
||
115 | |||
116 | yield [ |
||
117 | IO::VERBOSITY_VERBOSE, |
||
118 | false, |
||
119 | 50, |
||
120 | 'This is a title', |
||
121 | IO::VERBOSITY_NORMAL, |
||
122 | <<<'EOF' |
||
123 | |||
124 | This is a title |
||
125 | =============== |
||
126 | |||
127 | |||
128 | EOF |
||
129 | ]; |
||
130 | |||
131 | yield [ |
||
132 | IO::VERBOSITY_NORMAL, |
||
133 | false, |
||
134 | 50, |
||
135 | 'This is a title', |
||
136 | IO::VERBOSITY_VERBOSE, |
||
137 | '', |
||
138 | ]; |
||
139 | |||
140 | yield [ |
||
141 | IO::VERBOSITY_NORMAL, |
||
142 | false, |
||
143 | 15, |
||
144 | 'This is a very long title', |
||
145 | IO::VERBOSITY_NORMAL, |
||
146 | <<<'EOF' |
||
147 | |||
148 | This is a very |
||
149 | long title |
||
150 | =============== |
||
151 | |||
152 | |||
153 | EOF |
||
154 | ]; |
||
155 | |||
156 | yield [ |
||
157 | IO::VERBOSITY_NORMAL, |
||
158 | true, |
||
159 | 15, |
||
160 | 'This is a very long title', |
||
161 | IO::VERBOSITY_NORMAL, |
||
162 | <<<'EOF' |
||
163 | [33m[0m |
||
321 |