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