public static function get_nav_menu($theme_location = 'primary')
    {
        $menu = [];
        $term = static::get_menu_object($theme_location);

        if ($term !== false) {
            $menu_items_raw = \wp_get_nav_menu_items($term->term_id);

            // Collect the menu items.
            $menu_items = new Collection($menu_items_raw);

            // Create a flat array of non WP classes on these menu items.
            $custom_classes = $menu_items->pluck('classes')->flatten()->filter()->all();

            // Apply WP classes to the menu items. Subject to change.
            \_wp_menu_item_classes_by_context($menu_items_raw);

            foreach ($menu_items as $menu_item) {
                $is_active = false;

                $item_classes = \array_intersect($menu_item->classes, $custom_classes);

                if (\in_array('current-menu-item', $menu_item->classes)) {
                    $is_active = true;
                }

                $menu[ $menu_item->ID ] = (object) [];
                $menu[ $menu_item->ID ]->ID = $menu_item->object_id;
                $menu[ $menu_item->ID ]->text = $menu_item->title;
                $menu[ $menu_item->ID ]->title = $menu_item->attr_title;
                $menu[ $menu_item->ID ]->description = $menu_item->description;
                $menu[ $menu_item->ID ]->target = $menu_item->target;
                $menu[ $menu_item->ID ]->custom_classes = \implode(' ', $item_classes);
                $menu[ $menu_item->ID ]->url = $menu_item->url;
                $menu[ $menu_item->ID ]->children = [];
                $menu[ $menu_item->ID ]->has_children = false;
                $menu[ $menu_item->ID ]->is_active = $is_active;
                $menu[ $menu_item->ID ]->has_active_child = false;
            }

            foreach ($menu_items->reverse() as $menu_item) {
                if ($menu_item->menu_item_parent !== '0') {
                    $menu[ $menu_item->menu_item_parent ]->children[ $menu_item->ID ] = $menu[ $menu_item->ID ];

                    if ($menu[ $menu_item->ID ]->is_active || $menu[ $menu_item->ID ]->has_active_child) {
                        $menu[ $menu_item->menu_item_parent ]->has_active_child = true;
                    }

                    unset($menu[ $menu_item->ID ]);
                }
            }
        }

        return $menu;
    }