Code Duplication    Length = 16-16 lines in 6 locations

includes/admin/class-wpinv-admin-menus.php 6 locations

@@ 199-214 (lines=16) @@
196
        $items = array();
197
198
        $wpinv_history_page_id = (int)wpinv_get_option( 'invoice_history_page' );
199
        if($wpinv_history_page_id > 0){
200
            $item = new stdClass();
201
            $item->object_id = $wpinv_history_page_id;
202
            $item->db_id = 0;
203
            $item->object =  'page';
204
            $item->menu_item_parent = 0;
205
            $item->type = 'post_type';
206
            $item->title = __('Invoice History Page','invoicing');
207
            $item->url = get_permalink( $wpinv_history_page_id );
208
            $item->target = '';
209
            $item->attr_title = '';
210
            $item->classes = array('wpinv-menu-item');
211
            $item->xfn = '';
212
213
            $items['pages'][] = $item;
214
        }
215
216
        $wpinv_sub_history_page_id = (int)wpinv_get_option( 'invoice_subscription_page' );
217
        if($wpinv_sub_history_page_id > 0){
@@ 217-232 (lines=16) @@
214
        }
215
216
        $wpinv_sub_history_page_id = (int)wpinv_get_option( 'invoice_subscription_page' );
217
        if($wpinv_sub_history_page_id > 0){
218
            $item = new stdClass();
219
            $item->object_id = $wpinv_sub_history_page_id;
220
            $item->db_id = 0;
221
            $item->object =  'page';
222
            $item->menu_item_parent = 0;
223
            $item->type = 'post_type';
224
            $item->title = __('Invoice Subscriptions Page','invoicing');
225
            $item->url = get_permalink( $wpinv_sub_history_page_id );
226
            $item->target = '';
227
            $item->attr_title = '';
228
            $item->classes = array('wpinv-menu-item');
229
            $item->xfn = '';
230
231
            $items['pages'][] = $item;
232
        }
233
234
        $wpinv_checkout_page_id = (int)wpinv_get_option( 'checkout_page' );
235
        if($wpinv_checkout_page_id > 0){
@@ 235-250 (lines=16) @@
232
        }
233
234
        $wpinv_checkout_page_id = (int)wpinv_get_option( 'checkout_page' );
235
        if($wpinv_checkout_page_id > 0){
236
            $item = new stdClass();
237
            $item->object_id = $wpinv_checkout_page_id;
238
            $item->db_id = 0;
239
            $item->object =  'page';
240
            $item->menu_item_parent = 0;
241
            $item->type = 'post_type';
242
            $item->title = __('Checkout Page','invoicing');
243
            $item->url = get_permalink( $wpinv_checkout_page_id );
244
            $item->target = '';
245
            $item->attr_title = '';
246
            $item->classes = array('wpinv-menu-item');
247
            $item->xfn = '';
248
249
            $items['pages'][] = $item;
250
        }
251
252
        $wpinv_tandc_page_id = (int)wpinv_get_option( 'tandc_page' );
253
        if($wpinv_tandc_page_id > 0){
@@ 253-268 (lines=16) @@
250
        }
251
252
        $wpinv_tandc_page_id = (int)wpinv_get_option( 'tandc_page' );
253
        if($wpinv_tandc_page_id > 0){
254
            $item = new stdClass();
255
            $item->object_id = $wpinv_tandc_page_id;
256
            $item->db_id = 0;
257
            $item->object =  'page';
258
            $item->menu_item_parent = 0;
259
            $item->type = 'post_type';
260
            $item->title = __('Terms & Conditions','invoicing');
261
            $item->url = get_permalink( $wpinv_tandc_page_id );
262
            $item->target = '';
263
            $item->attr_title = '';
264
            $item->classes = array('wpinv-menu-item');
265
            $item->xfn = '';
266
267
            $items['pages'][] = $item;
268
        }
269
270
        $wpinv_success_page_id = (int)wpinv_get_option( 'success_page' );
271
        if($wpinv_success_page_id > 0){
@@ 271-286 (lines=16) @@
268
        }
269
270
        $wpinv_success_page_id = (int)wpinv_get_option( 'success_page' );
271
        if($wpinv_success_page_id > 0){
272
            $item = new stdClass();
273
            $item->object_id = $wpinv_success_page_id;
274
            $item->db_id = 0;
275
            $item->object =  'page';
276
            $item->menu_item_parent = 0;
277
            $item->type = 'post_type';
278
            $item->title = __('Success Page','invoicing');
279
            $item->url = get_permalink( $wpinv_success_page_id );
280
            $item->target = '';
281
            $item->attr_title = '';
282
            $item->classes = array('wpinv-menu-item');
283
            $item->xfn = '';
284
285
            $items['pages'][] = $item;
286
        }
287
288
        $wpinv_failure_page_id = (int)wpinv_get_option( 'failure_page' );
289
        if($wpinv_failure_page_id > 0){
@@ 289-304 (lines=16) @@
286
        }
287
288
        $wpinv_failure_page_id = (int)wpinv_get_option( 'failure_page' );
289
        if($wpinv_failure_page_id > 0){
290
            $item = new stdClass();
291
            $item->object_id = $wpinv_failure_page_id;
292
            $item->db_id = 0;
293
            $item->object =  'page';
294
            $item->menu_item_parent = 0;
295
            $item->type = 'post_type';
296
            $item->title = __('Failed Transaction Page','invoicing');
297
            $item->url = get_permalink( $wpinv_failure_page_id );
298
            $item->target = '';
299
            $item->attr_title = '';
300
            $item->classes = array('wpinv-menu-item');
301
            $item->xfn = '';
302
303
            $items['pages'][] = $item;
304
        }
305
306
        return apply_filters( 'wpinv_menu_items', $items );
307
    }