Conditions | 1 |
Paths | 1 |
Total Lines | 244 |
Code Lines | 209 |
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 |
||
40 | public function zillow_badges() { |
||
41 | |||
42 | return array( |
||
43 | /* Premier Agent. */ |
||
44 | array( |
||
45 | 'id' => 'premier-agent', |
||
46 | 'name' => __( 'Zillow Premier Agent', 're-pro' ), |
||
47 | 'alt' => __( 'Zillow Premier Agent', 're-pro' ), |
||
48 | 'title' => __( 'Zillow Premier Agent', 're-pro' ), |
||
49 | 'class' => 'zillow-badge', |
||
50 | 'url' => 'https://www.zillowstatic.com/static/images/badges/premier-agent.png', |
||
51 | 'width' => 100, |
||
52 | 'height' => 74, |
||
53 | ), |
||
54 | /* Featured .*/ |
||
55 | array( |
||
56 | 'id' => 'feature-badge-sm', |
||
57 | 'name' => __( 'Featured on Zillow - Small', 're-pro' ), |
||
58 | 'alt' => __( 'Featured on Zillow', 're-pro' ), |
||
59 | 'title' => __( 'Featured on Zillow', 're-pro' ), |
||
60 | 'class' => 'zillow-badge', |
||
61 | 'url' => 'https://www.zillowstatic.com/static/images/badges/feature_badge_sm.png', |
||
62 | 'width' => 100, |
||
63 | 'height' => 74, |
||
64 | ), |
||
65 | array( |
||
66 | 'id' => 'feature-badge-lg', |
||
67 | 'name' => __( 'Featured on Zillow - Large', 're-pro' ), |
||
68 | 'alt' => __( 'Featured on Zillow', 're-pro' ), |
||
69 | 'title' => __( 'Featured on Zillow', 're-pro' ), |
||
70 | 'class' => 'zillow-badge', |
||
71 | 'url' => 'https://www.zillowstatic.com/static/images/badges/feature_badge_lg.png', |
||
72 | 'width' => 100, |
||
73 | 'height' => 74, |
||
74 | ), |
||
75 | /* View My Profile. */ |
||
76 | array( |
||
77 | 'id' => 'view-my-profile', |
||
78 | 'name' => __( 'View my Profile', 're-pro' ), |
||
79 | 'alt' => __( 'View my Profile', 're-pro' ), |
||
80 | 'title' => __( 'View my Profile', 're-pro' ), |
||
81 | 'class' => 'zillow-badge', |
||
82 | 'url' => 'https://www.zillowstatic.com/static/images/badges/bdg_profile.gif', |
||
83 | 'width' => 160, |
||
84 | 'height' => 40, |
||
85 | ), |
||
86 | /* Feature My Listings - 160 x 40. */ |
||
87 | array( |
||
88 | 'id' => 'my-listing-bllg', |
||
89 | 'name' => __( 'Feature My Listings 1', 're-pro' ), |
||
90 | 'alt' => __( 'I feature my listings on Zillow', 're-pro' ), |
||
91 | 'title' => __( 'I feature my listings on Zillow', 're-pro' ), |
||
92 | 'class' => 'zillow-badge', |
||
93 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-my-listing_bllg.gif', |
||
94 | 'width' => 160, |
||
95 | 'height' => 40, |
||
96 | ), |
||
97 | array( |
||
98 | 'id' => 'my-listing-trlg', |
||
99 | 'name' => __( 'Feature My Listings 2', 're-pro' ), |
||
100 | 'alt' => __( 'I feature my listings on Zillow', 're-pro' ), |
||
101 | 'title' => __( 'I feature my listings on Zillow', 're-pro' ), |
||
102 | 'class' => 'zillow-badge', |
||
103 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-my-listing_trlg.gif', |
||
104 | 'width' => 160, |
||
105 | 'height' => 40, |
||
106 | ), |
||
107 | array( |
||
108 | 'id' => 'my-listing-grlg', |
||
109 | 'name' => __( 'Feature My Listings 3', 're-pro' ), |
||
110 | 'alt' => __( 'I feature my listings on Zillow', 're-pro' ), |
||
111 | 'title' => __( 'I feature my listings on Zillow', 're-pro' ), |
||
112 | 'class' => 'zillow-badge', |
||
113 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-my-listing_grlg.gif', |
||
114 | 'width' => 160, |
||
115 | 'height' => 40, |
||
116 | ), |
||
117 | /* ZILLOW ADDICT - 160 x 40 */ |
||
118 | array( |
||
119 | 'id' => 'addict-bllg', |
||
120 | 'name' => __( 'Zillow Addict 1 (160X40)', 're-pro' ), |
||
121 | 'alt' => __( 'Zillow Addict', 're-pro' ), |
||
122 | 'title' => __( 'Zillow Addict', 're-pro' ), |
||
123 | 'class' => 'zillow-badge', |
||
124 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-addict_bllg.gif', |
||
125 | 'width' => 160, |
||
126 | 'height' => 40, |
||
127 | ), |
||
128 | array( |
||
129 | 'id' => 'addict-trlg', |
||
130 | 'name' => __( 'Zillow Addict 2 (160X40)', 're-pro' ), |
||
131 | 'alt' => __( 'Zillow Addict', 're-pro' ), |
||
132 | 'title' => __( 'Zillow Addict', 're-pro' ), |
||
133 | 'class' => 'zillow-badge', |
||
134 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-addict_trlg.png', |
||
135 | 'width' => 160, |
||
136 | 'height' => 40, |
||
137 | ), |
||
138 | array( |
||
139 | 'id' => 'addict-grlg', |
||
140 | 'name' => __( 'Zillow Addict 3 (160X40)', 're-pro' ), |
||
141 | 'alt' => __( 'Zillow Addict', 're-pro' ), |
||
142 | 'title' => __( 'Zillow Addict', 're-pro' ), |
||
143 | 'class' => 'zillow-badge', |
||
144 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-addict_grlg.gif', |
||
145 | 'width' => 160, |
||
146 | 'height' => 40, |
||
147 | ), |
||
148 | /* ZILLOW ADDICT - 100 x 40 */ |
||
149 | array( |
||
150 | 'id' => 'addict-blsm', |
||
151 | 'name' => __( 'Zillow Addict 1 (100X40)', 're-pro' ), |
||
152 | 'alt' => __( 'Zillow Addict', 're-pro' ), |
||
153 | 'title' => __( 'Zillow Addict', 're-pro' ), |
||
154 | 'class' => 'zillow-badge', |
||
155 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-addict_blsm.gif', |
||
156 | 'width' => 100, |
||
157 | 'height' => 40, |
||
158 | ), |
||
159 | array( |
||
160 | 'id' => 'addict-trsm', |
||
161 | 'name' => __( 'Zillow Addict 2 (100X40)', 're-pro' ), |
||
162 | 'alt' => __( 'Zillow Addict', 're-pro' ), |
||
163 | 'title' => __( 'Zillow Addict', 're-pro' ), |
||
164 | 'class' => 'zillow-badge', |
||
165 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-addict_trsm.png', |
||
166 | 'width' => 100, |
||
167 | 'height' => 40, |
||
168 | ), |
||
169 | array( |
||
170 | 'id' => 'addict-grsm', |
||
171 | 'name' => __( 'Zillow Addict 3 (100X40)', 're-pro' ), |
||
172 | 'alt' => __( 'Zillow Addict', 're-pro' ), |
||
173 | 'title' => __( 'Zillow Addict', 're-pro' ), |
||
174 | 'class' => 'zillow-badge', |
||
175 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-addict_grsm.gif', |
||
176 | 'width' => 100, |
||
177 | 'height' => 40, |
||
178 | ), |
||
179 | /* REAL ESTATE FANATIC - 160 x 40 */ |
||
180 | array( |
||
181 | 'id' => 'fanatic-bllg', |
||
182 | 'name' => __( 'Real Estate Fanatic 1 (160X40)', 're-pro' ), |
||
183 | 'alt' => __( 'Real Estate Fanatic', 're-pro' ), |
||
184 | 'title' => __( 'Real Estate Fanatic', 're-pro' ), |
||
185 | 'class' => 'zillow-badge', |
||
186 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-fanatic_bllg.gif', |
||
187 | 'width' => 160, |
||
188 | 'height' => 40, |
||
189 | ), |
||
190 | array( |
||
191 | 'id' => 'fanatic-trlg', |
||
192 | 'name' => __( 'Real Estate Fanatic 2 (160X40)', 're-pro' ), |
||
193 | 'alt' => __( 'Real Estate Fanatic', 're-pro' ), |
||
194 | 'title' => __( 'Real Estate Fanatic', 're-pro' ), |
||
195 | 'class' => 'zillow-badge', |
||
196 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-fanatic_trlg.gif', |
||
197 | 'width' => 160, |
||
198 | 'height' => 40, |
||
199 | ), |
||
200 | array( |
||
201 | 'id' => 'fanatic-grlg', |
||
202 | 'name' => __( 'Real Estate Fanatic 3 (160X40)', 're-pro' ), |
||
203 | 'alt' => __( 'Real Estate Fanatic', 're-pro' ), |
||
204 | 'title' => __( 'Real Estate Fanatic', 're-pro' ), |
||
205 | 'class' => 'zillow-badge', |
||
206 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-fanatic_grlg.gif', |
||
207 | 'width' => 160, |
||
208 | 'height' => 40, |
||
209 | ), |
||
210 | /* REAL ESTATE FANATIC - 120X40 */ |
||
211 | array( |
||
212 | 'id' => 'fanatic-blsm', |
||
213 | 'name' => __( 'Real Estate Fanatic 1 (120X40)', 're-pro' ), |
||
214 | 'alt' => __( 'Real Estate Fanatic', 're-pro' ), |
||
215 | 'title' => __( 'Real Estate Fanatic', 're-pro' ), |
||
216 | 'class' => 'zillow-badge', |
||
217 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-fanatic_blsm.gif', |
||
218 | 'width' => 120, |
||
219 | 'height' => 40, |
||
220 | ), |
||
221 | array( |
||
222 | 'id' => 'fanatic-trsm', |
||
223 | 'name' => __( 'Real Estate Fanatic 2 (120X40)', 're-pro' ), |
||
224 | 'alt' => __( 'Real Estate Fanatic', 're-pro' ), |
||
225 | 'title' => __( 'Real Estate Fanatic', 're-pro' ), |
||
226 | 'class' => 'zillow-badge', |
||
227 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-fanatic_trsm.gif', |
||
228 | 'width' => 120, |
||
229 | 'height' => 40, |
||
230 | ), |
||
231 | array( |
||
232 | 'id' => 'fanatic-grsm', |
||
233 | 'name' => __( 'Real Estate Fanatic 3 (120X40)', 're-pro' ), |
||
234 | 'alt' => __( 'Real Estate Fanatic', 're-pro' ), |
||
235 | 'title' => __( 'Real Estate Fanatic', 're-pro' ), |
||
236 | 'class' => 'zillow-badge', |
||
237 | 'url' => 'https://www.zillowstatic.com/static/images/badges/zillow-fanatic_grsm.gif', |
||
238 | 'width' => 120, |
||
239 | 'height' => 40, |
||
240 | ), |
||
241 | /* Dig Influencer */ |
||
242 | array( |
||
243 | 'id' => 'dig-square-influencer', |
||
244 | 'name' => __( 'Dig Influencer Square', 're-pro' ), |
||
245 | 'alt' => __( 'Dig Influencer', 're-pro' ), |
||
246 | 'title' => __( 'Dig Influencer', 're-pro' ), |
||
247 | 'class' => 'zillow-badge', |
||
248 | 'url' => 'https://www.zillowstatic.com/static/images/badges/square-influencer.png', |
||
249 | 'width' => 72, |
||
250 | 'height' => 72, |
||
251 | ), |
||
252 | array( |
||
253 | 'id' => 'dig-rectangle-influencer', |
||
254 | 'name' => __( 'Dig Rectangle Influencer', 're-pro' ), |
||
255 | 'alt' => __( 'Dig Influencer', 're-pro' ), |
||
256 | 'title' => __( 'Dig Influencer', 're-pro' ), |
||
257 | 'class' => 'zillow-badge', |
||
258 | 'url' => 'https://www.zillowstatic.com/static/images/badges/rectangle-influencer.png', |
||
259 | 'width' => 109, |
||
260 | 'height' => 35, |
||
261 | ), |
||
262 | array( |
||
263 | 'id' => 'dig-square-pro', |
||
264 | 'name' => __( 'Dig Square Pro', 're-pro' ), |
||
265 | 'alt' => __( 'Dig Influencer', 're-pro' ), |
||
266 | 'title' => __( 'Dig Influencer', 're-pro' ), |
||
267 | 'class' => 'zillow-badge', |
||
268 | 'url' => 'https://www.zillowstatic.com/static/images/badges/square-pro.png', |
||
269 | 'width' => 72, |
||
270 | 'height' => 72, |
||
271 | ), |
||
272 | array( |
||
273 | 'id' => 'dig-rectangle-pro', |
||
274 | 'name' => __( 'Dig Rectangle Pro', 're-pro' ), |
||
275 | 'alt' => __( 'Dig Influencer', 're-pro' ), |
||
276 | 'title' => __( 'Dig Influencer', 're-pro' ), |
||
277 | 'class' => 'zillow-badge', |
||
278 | 'url' => 'https://www.zillowstatic.com/static/images/badges/rectangle-pro.png', |
||
279 | 'width' => 109, |
||
280 | 'height' => 35, |
||
281 | ), |
||
282 | ); |
||
283 | } |
||
284 | |||
416 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.