original_string: 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);
              }
          }
      }
code: 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);
              }
          }
      }
code_tokens: 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 ) ; } } }
docstring: 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
docstring_tokens: Internal method for counting items in menu .