Conditions | 1 |
Paths | 1 |
Total Lines | 74 |
Code Lines | 44 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
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 |
||
127 | protected function getItems() |
||
128 | { |
||
129 | $items = ItemFactory::createFromApplicationItems( |
||
130 | [ |
||
131 | // Stylesheet link item |
||
132 | new ApplicationItem( |
||
133 | LinkType::FORMAT, |
||
134 | new PropertyListFactory(), |
||
135 | (object)['profile' => LinkType::HTML_PROFILE_URI, 'name' => 'stylesheet'], |
||
136 | [ |
||
137 | (object)[ |
||
138 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
139 | 'name' => 'type', |
||
140 | 'values' => [ |
||
141 | new StringValue('text/css') |
||
142 | ] |
||
143 | ], |
||
144 | (object)[ |
||
145 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
146 | 'name' => 'href', |
||
147 | 'values' => [ |
||
148 | new StringValue('style.css') |
||
149 | ] |
||
150 | ] |
||
151 | ], |
||
152 | [], |
||
153 | 'main-stylesheet' |
||
154 | ), |
||
155 | |||
156 | // Atom feed link item |
||
157 | new ApplicationItem( |
||
158 | LinkType::FORMAT, |
||
159 | new PropertyListFactory(), |
||
160 | (object)['profile' => LinkType::HTML_PROFILE_URI, 'name' => 'alternate'], |
||
161 | [ |
||
162 | (object)[ |
||
163 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
164 | 'name' => 'type', |
||
165 | 'values' => [ |
||
166 | new StringValue('application/atom+xml') |
||
167 | ] |
||
168 | ], |
||
169 | (object)[ |
||
170 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
171 | 'name' => 'href', |
||
172 | 'values' => [ |
||
173 | new StringValue('http://example.com/blog.atom') |
||
174 | ] |
||
175 | ], |
||
176 | (object)[ |
||
177 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
178 | 'name' => 'title', |
||
179 | 'values' => [ |
||
180 | new StringValue('Atom feed') |
||
181 | ] |
||
182 | ], |
||
183 | (object)[ |
||
184 | 'profile' => 'http://example.com/test-ns', |
||
185 | 'name' => 'prop', |
||
186 | 'values' => [ |
||
187 | new StringValue('arbitrary') |
||
188 | ] |
||
189 | ] |
||
190 | ], |
||
191 | [], |
||
192 | 'main-stylesheet' |
||
193 | ), |
||
194 | ] |
||
195 | ); |
||
196 | |||
197 | $items[] = $this->getFeedItem(); |
||
198 | |||
199 | return $items; |
||
200 | } |
||
201 | } |
||
202 |