Menu\Items\ItemList::getItemListsAtDepthRange PHP Method

getItemListsAtDepthRange() public method

Get itemlists in a range of depths
public getItemListsAtDepthRange ( $from, $to ) : Vespakoen\Menu\MenuHandler
return Vespakoen\Menu\MenuHandler
    public function getItemListsAtDepthRange($from, $to)
    {
        $itemListsWithDepth = $this->getItemListsWithDepth();
        $results = array();
        foreach ($itemListsWithDepth as $depth => $itemLists) {
            if ($depth >= $from && $depth <= $to) {
                foreach ($itemLists as $itemList) {
                    $results[] = $itemList;
                }
            }
        }
        return new MenuHandler($results);
    }