Conditions | 1 |
Paths | 1 |
Total Lines | 57 |
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 |
||
93 | public function ao_partners_page() |
||
94 | { |
||
95 | ?> |
||
96 | <style> |
||
97 | .itemDetail { |
||
98 | background: #fff; |
||
99 | width: 250px; |
||
100 | min-height: 290px; |
||
101 | border: 1px solid #ccc; |
||
102 | float: left; |
||
103 | padding: 15px; |
||
104 | position: relative; |
||
105 | margin: 0 10px 10px 0; |
||
106 | } |
||
107 | .itemTitle { |
||
108 | margin-top:0px; |
||
109 | margin-bottom:10px; |
||
110 | } |
||
111 | .itemImage { |
||
112 | text-align: center; |
||
113 | } |
||
114 | .itemImage img { |
||
115 | max-width: 95%; |
||
116 | max-height: 150px; |
||
117 | } |
||
118 | .itemDescription { |
||
119 | margin-bottom:30px; |
||
120 | } |
||
121 | .itemButtonRow { |
||
122 | position: absolute; |
||
123 | bottom: 10px; |
||
124 | right: 10px; |
||
125 | width:100%; |
||
126 | } |
||
127 | .itemButton { |
||
128 | float:right; |
||
129 | } |
||
130 | .itemButton a { |
||
131 | text-decoration: none; |
||
132 | color: #555; |
||
133 | } |
||
134 | .itemButton a:hover { |
||
135 | text-decoration: none; |
||
136 | color: #23282d; |
||
137 | } |
||
138 | </style> |
||
139 | <script>document.title = "Autoptimize: <?php _e( 'Optimize More!', 'autoptimize' ); ?> " + document.title;</script> |
||
140 | <div class="wrap"> |
||
141 | <h1><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1> |
||
142 | <?php echo autoptimizeConfig::ao_admin_tabs(); ?> |
||
143 | <?php echo '<h2>' . __( "These Autoptimize power-ups and related services will improve your site's performance even more!", 'autoptimize' ) . '</h2>'; ?> |
||
144 | <div> |
||
145 | <?php echo $this->get_ao_partner_feed_markup(); ?> |
||
146 | </div> |
||
147 | </div> |
||
148 | <?php |
||
149 | } |
||
150 | } |
||
151 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.