protected function _count($items)
    {
        foreach ($items as $item) {
            $this->_count++;
            $item = is_array($item) ? new Entity($item) : $item;

            if ($item->has('children') && !empty($item->children) && $item->expanded) {
                $this->_count($item->children);
            }
        }
    }
protected function _count($items)
    {
        foreach ($items as $item) {
            $this->_count++;
            $item = is_array($item) ? new Entity($item) : $item;

            if ($item->has('children') && !empty($item->children) && $item->expanded) {
                $this->_count($item->children);
            }
        }
    }
protected function _count ( $ items ) { foreach ( $ items as $ item ) { $ this -> _count ++ ; $ item = is_array ( $ item ) ? new Entity ( $ item ) : $ item ; if ( $ item -> has ( 'children' ) && ! empty ( $ item -> children ) && $ item -> expanded ) { $ this -> _count ( $ item -> children ) ; } } }
Internal method for counting items in menu.

This method will ignore children if parent has been marked as `do no expand`.

@param \Cake\ORM\Query $items Items to count
@return int
Internal method for counting items in menu .