Code Duplication    Length = 18-18 lines in 2 locations

includes/wp-api-menus-v1.php 1 location

@@ 195-212 (lines=18) @@
192
			}
193
194
			$menu = array();
195
			while ( $sorted_menu_items ) :
196
197
				$i = 0;
198
				foreach ( $top_level_menu_items as $top_item ) :
199
200
					$menu[ $i ] = $this->format_menu_item( $top_item, false );
201
					if ( isset( $menu_items_with_children[ $top_item->ID ] ) ) {
202
						$menu[ $i ]['children'] = $this->get_nav_menu_item_children( $top_item->ID, $menu_items, false );
203
					} else {
204
						$menu[ $i ]['children'] = array();
205
					}
206
207
					$i++;
208
				endforeach;
209
210
				break;
211
212
			endwhile;
213
214
			return $menu;
215
		}

includes/wp-api-menus-v2.php 1 location

@@ 289-306 (lines=18) @@
286
287
            $menu = array();
288
289
            while ( $sorted_menu_items ) :
290
291
                $i = 0;
292
                foreach ( $top_level_menu_items as $top_item ) :
293
294
                    $menu[ $i ] = $this->format_menu_item( $top_item, false );
295
                    if ( isset( $menu_items_with_children[ $top_item->ID ] ) ) {
296
	                    $menu[ $i ]['children'] = $this->get_nav_menu_item_children( $top_item->ID, $menu_items, false );
297
                    } else {
298
	                    $menu[ $i ]['children'] = array();
299
                    }
300
301
                    $i++;
302
                endforeach;
303
304
                break;
305
306
            endwhile;
307
308
            return $menu;
309
        }