data = $data; } /** * Counts how many items the menu has. * * @return int */ public function count(): int { $items = $this->data['array-list-items'] ?? null; if ( $items ) { return count( $items ); } $htmlItems = $this->data['html-items'] ?? ''; return substr_count( $htmlItems, 'data + [ 'class' => '', 'label' => '', 'html-tooltip' => '', 'label-class' => '', 'html-before-portal' => '', 'html-items' => '', 'html-after-portal' => '', 'array-list-items' => null, ]; } }