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