Code Duplication    Length = 16-16 lines in 6 locations

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

@@ 178-193 (lines=16) @@
175
        $items = array();
176
177
        $wpinv_history_page_id = (int)wpinv_get_option( 'invoice_history_page' );
178
        if($wpinv_history_page_id > 0){
179
            $item = new stdClass();
180
            $item->object_id = $wpinv_history_page_id;
181
            $item->db_id = 0;
182
            $item->object =  'page';
183
            $item->menu_item_parent = 0;
184
            $item->type = 'post_type';
185
            $item->title = __('Invoice History Page','invoicing');
186
            $item->url = get_permalink( $wpinv_history_page_id );
187
            $item->target = '';
188
            $item->attr_title = '';
189
            $item->classes = array('wpinv-menu-item');
190
            $item->xfn = '';
191
192
            $items['pages'][] = $item;
193
        }
194
195
        $wpinv_sub_history_page_id = (int)wpinv_get_option( 'invoice_subscription_page' );
196
        if($wpinv_sub_history_page_id > 0){
@@ 196-211 (lines=16) @@
193
        }
194
195
        $wpinv_sub_history_page_id = (int)wpinv_get_option( 'invoice_subscription_page' );
196
        if($wpinv_sub_history_page_id > 0){
197
            $item = new stdClass();
198
            $item->object_id = $wpinv_sub_history_page_id;
199
            $item->db_id = 0;
200
            $item->object =  'page';
201
            $item->menu_item_parent = 0;
202
            $item->type = 'post_type';
203
            $item->title = __('Invoice Subscriptions Page','invoicing');
204
            $item->url = get_permalink( $wpinv_sub_history_page_id );
205
            $item->target = '';
206
            $item->attr_title = '';
207
            $item->classes = array('wpinv-menu-item');
208
            $item->xfn = '';
209
210
            $items['pages'][] = $item;
211
        }
212
213
        $wpinv_checkout_page_id = (int)wpinv_get_option( 'checkout_page' );
214
        if($wpinv_checkout_page_id > 0){
@@ 214-229 (lines=16) @@
211
        }
212
213
        $wpinv_checkout_page_id = (int)wpinv_get_option( 'checkout_page' );
214
        if($wpinv_checkout_page_id > 0){
215
            $item = new stdClass();
216
            $item->object_id = $wpinv_checkout_page_id;
217
            $item->db_id = 0;
218
            $item->object =  'page';
219
            $item->menu_item_parent = 0;
220
            $item->type = 'post_type';
221
            $item->title = __('Checkout Page','invoicing');
222
            $item->url = get_permalink( $wpinv_checkout_page_id );
223
            $item->target = '';
224
            $item->attr_title = '';
225
            $item->classes = array('wpinv-menu-item');
226
            $item->xfn = '';
227
228
            $items['pages'][] = $item;
229
        }
230
231
        $wpinv_tandc_page_id = (int)wpinv_get_option( 'tandc_page' );
232
        if($wpinv_tandc_page_id > 0){
@@ 232-247 (lines=16) @@
229
        }
230
231
        $wpinv_tandc_page_id = (int)wpinv_get_option( 'tandc_page' );
232
        if($wpinv_tandc_page_id > 0){
233
            $item = new stdClass();
234
            $item->object_id = $wpinv_tandc_page_id;
235
            $item->db_id = 0;
236
            $item->object =  'page';
237
            $item->menu_item_parent = 0;
238
            $item->type = 'post_type';
239
            $item->title = __('Terms & Conditions','invoicing');
240
            $item->url = get_permalink( $wpinv_tandc_page_id );
241
            $item->target = '';
242
            $item->attr_title = '';
243
            $item->classes = array('wpinv-menu-item');
244
            $item->xfn = '';
245
246
            $items['pages'][] = $item;
247
        }
248
249
        $wpinv_success_page_id = (int)wpinv_get_option( 'success_page' );
250
        if($wpinv_success_page_id > 0){
@@ 250-265 (lines=16) @@
247
        }
248
249
        $wpinv_success_page_id = (int)wpinv_get_option( 'success_page' );
250
        if($wpinv_success_page_id > 0){
251
            $item = new stdClass();
252
            $item->object_id = $wpinv_success_page_id;
253
            $item->db_id = 0;
254
            $item->object =  'page';
255
            $item->menu_item_parent = 0;
256
            $item->type = 'post_type';
257
            $item->title = __('Success Page','invoicing');
258
            $item->url = get_permalink( $wpinv_success_page_id );
259
            $item->target = '';
260
            $item->attr_title = '';
261
            $item->classes = array('wpinv-menu-item');
262
            $item->xfn = '';
263
264
            $items['pages'][] = $item;
265
        }
266
267
        $wpinv_failure_page_id = (int)wpinv_get_option( 'failure_page' );
268
        if($wpinv_failure_page_id > 0){
@@ 268-283 (lines=16) @@
265
        }
266
267
        $wpinv_failure_page_id = (int)wpinv_get_option( 'failure_page' );
268
        if($wpinv_failure_page_id > 0){
269
            $item = new stdClass();
270
            $item->object_id = $wpinv_failure_page_id;
271
            $item->db_id = 0;
272
            $item->object =  'page';
273
            $item->menu_item_parent = 0;
274
            $item->type = 'post_type';
275
            $item->title = __('Failed Transaction Page','invoicing');
276
            $item->url = get_permalink( $wpinv_failure_page_id );
277
            $item->target = '';
278
            $item->attr_title = '';
279
            $item->classes = array('wpinv-menu-item');
280
            $item->xfn = '';
281
282
            $items['pages'][] = $item;
283
        }
284
285
        return apply_filters( 'wpinv_menu_items', $items );
286
    }