Conditions | 10 |
Paths | 9 |
Total Lines | 21 |
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 |
||
53 | function render_title( $player_id, $title, $link, $track ) { |
||
54 | if ( ! isset( $title ) && empty( $track ) && ! isset( $track['title'] ) ) { |
||
55 | return; |
||
56 | } |
||
57 | ?> |
||
58 | <h2 id=<?php echo esc_attr( $player_id ); ?>__title" class="jetpack-podcast-player__title"> |
||
59 | <?php if ( ! empty( $track ) && isset( $track['title'] ) ) : ?> |
||
60 | <span class="jetpack-podcast-player__current-track-title"> |
||
61 | <?php echo $track['title']; ?> |
||
62 | </span> |
||
63 | <?php endif; ?> |
||
64 | |||
65 | <?php if ( ! empty( $track ) && isset( $track['title'] ) && isset( $title ) ) : ?> |
||
66 | <span class="jetpack-podcast-player--visually-hidden"> - </span> |
||
67 | <?php endif; ?> |
||
68 | |||
69 | <?php if ( isset( $title ) ) : ?> |
||
70 | <?php render_podcast_title( $title, $link ); ?> |
||
71 | <?php endif; ?> |
||
72 | </h2> |
||
73 | <?php } ?> |
||
74 | |||
97 |