Conditions | 1 |
Paths | 1 |
Total Lines | 74 |
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 |
||
105 | protected function getItems() |
||
106 | { |
||
107 | $items = ItemFactory::createFromApplicationItems( |
||
108 | [ |
||
109 | // Stylesheet link item |
||
110 | new ApplicationItem( |
||
111 | LinkType::FORMAT, |
||
112 | new PropertyListFactory(), |
||
113 | (object)['profile' => LinkType::HTML_PROFILE_URI, 'name' => 'stylesheet'], |
||
114 | [ |
||
115 | (object)[ |
||
116 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
117 | 'name' => 'type', |
||
118 | 'values' => [ |
||
119 | new StringValue('text/css') |
||
120 | ] |
||
121 | ], |
||
122 | (object)[ |
||
123 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
124 | 'name' => 'href', |
||
125 | 'values' => [ |
||
126 | new StringValue('style.css') |
||
127 | ] |
||
128 | ] |
||
129 | ], |
||
130 | [], |
||
131 | 'main-stylesheet' |
||
132 | ), |
||
133 | |||
134 | // Atom feed link item |
||
135 | new ApplicationItem( |
||
136 | LinkType::FORMAT, |
||
137 | new PropertyListFactory(), |
||
138 | (object)['profile' => LinkType::HTML_PROFILE_URI, 'name' => 'alternate'], |
||
139 | [ |
||
140 | (object)[ |
||
141 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
142 | 'name' => 'type', |
||
143 | 'values' => [ |
||
144 | new StringValue('application/atom+xml') |
||
145 | ] |
||
146 | ], |
||
147 | (object)[ |
||
148 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
149 | 'name' => 'href', |
||
150 | 'values' => [ |
||
151 | new StringValue('http://example.com/blog.atom') |
||
152 | ] |
||
153 | ], |
||
154 | (object)[ |
||
155 | 'profile' => LinkType::HTML_PROFILE_URI, |
||
156 | 'name' => 'title', |
||
157 | 'values' => [ |
||
158 | new StringValue('Atom feed') |
||
159 | ] |
||
160 | ], |
||
161 | (object)[ |
||
162 | 'profile' => 'http://example.com/test-ns', |
||
163 | 'name' => 'prop', |
||
164 | 'values' => [ |
||
165 | new StringValue('arbitrary') |
||
166 | ] |
||
167 | ] |
||
168 | ], |
||
169 | [], |
||
170 | 'main-stylesheet' |
||
171 | ), |
||
172 | ] |
||
173 | ); |
||
174 | |||
175 | $items[] = $this->getFeedItem(); |
||
176 | |||
177 | return $items; |
||
178 | } |
||
179 | |||
209 |