Conditions | 1 |
Paths | 1 |
Total Lines | 107 |
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 |
||
261 | public function doiLinkedTextProvider() { |
||
262 | |||
263 | // DOI |
||
264 | |||
265 | $provider[] = [ |
||
266 | '_sci_doi', |
||
267 | 'foo', |
||
268 | '', |
||
269 | '' |
||
270 | ]; |
||
271 | |||
272 | $provider[] = [ |
||
273 | '_sci_doi', |
||
274 | '10.1000/123456', |
||
275 | '<span class="plainlinks">[https://doi.org/10.1000%2F123456 10.1000/123456]</span>', |
||
276 | '<a href="https://doi.org/10.1000/123456" target="_blank">10.1000/123456</a>' |
||
277 | ]; |
||
278 | |||
279 | $provider[] = [ |
||
280 | '_sci_doi', |
||
281 | 'http://dx.doi.org/10.1000/123456', |
||
282 | '<span class="plainlinks">[https://doi.org/10.1000%2F123456 10.1000/123456]</span>', |
||
283 | '<a href="https://doi.org/10.1000/123456" target="_blank">10.1000/123456</a>' |
||
284 | ]; |
||
285 | |||
286 | // PMC |
||
287 | |||
288 | $provider[] = [ |
||
289 | '_sci_pmcid', |
||
290 | 'foo', |
||
291 | '', |
||
292 | '' |
||
293 | ]; |
||
294 | |||
295 | $provider[] = [ |
||
296 | '_sci_pmcid', |
||
297 | 'PMC123456', |
||
298 | '<span class="plainlinks">[https://www.ncbi.nlm.nih.gov/pmc/PMC123456 PMC123456]</span>', |
||
299 | '<a href="https://www.ncbi.nlm.nih.gov/pmc/PMC123456" target="_blank">PMC123456</a>' |
||
300 | ]; |
||
301 | |||
302 | // VIAF |
||
303 | |||
304 | $provider[] = [ |
||
305 | '_sci_viaf', |
||
306 | 'foo', |
||
307 | '', |
||
308 | '' |
||
309 | ]; |
||
310 | |||
311 | $provider[] = [ |
||
312 | '_sci_viaf', |
||
313 | 'VIAF123456', |
||
314 | '<span class="plainlinks">[https://viaf.org/viaf/123456 123456]</span>', |
||
315 | '<a href="https://viaf.org/viaf/123456" target="_blank">123456</a>' |
||
316 | ]; |
||
317 | |||
318 | // OCLC |
||
319 | |||
320 | $provider[] = [ |
||
321 | '_sci_oclc', |
||
322 | 'foo', |
||
323 | '', |
||
324 | '' |
||
325 | ]; |
||
326 | |||
327 | $provider[] = [ |
||
328 | '_sci_oclc', |
||
329 | 'OCLC123456', |
||
330 | '<span class="plainlinks">[https://www.worldcat.org/oclc/123456 123456]</span>', |
||
331 | '<a href="https://www.worldcat.org/oclc/123456" target="_blank">123456</a>' |
||
332 | ]; |
||
333 | |||
334 | // PMID |
||
335 | |||
336 | $provider[] = [ |
||
337 | '_sci_pmid', |
||
338 | 'foo', |
||
339 | '', |
||
340 | '' |
||
341 | ]; |
||
342 | |||
343 | $provider[] = [ |
||
344 | '_sci_pmid', |
||
345 | 'PMID123456', |
||
346 | '<span class="plainlinks">[https://www.ncbi.nlm.nih.gov/pubmed/123456 123456]</span>', |
||
347 | '<a href="https://www.ncbi.nlm.nih.gov/pubmed/123456" target="_blank">123456</a>' |
||
348 | ]; |
||
349 | |||
350 | // OLID |
||
351 | |||
352 | $provider[] = [ |
||
353 | '_sci_olid', |
||
354 | 'foo', |
||
355 | '', |
||
356 | '' |
||
357 | ]; |
||
358 | |||
359 | $provider[] = [ |
||
360 | '_sci_olid', |
||
361 | 'OL123456M', |
||
362 | '<span class="plainlinks">[https://openlibrary.org/books/OL123456M OL123456M]</span>', |
||
363 | '<a href="https://openlibrary.org/books/OL123456M" target="_blank">OL123456M</a>' |
||
364 | ]; |
||
365 | |||
366 | return $provider; |
||
367 | } |
||
368 | |||
393 |