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