$labels Whatever getForEvent() * returned — its keys are not meaningful here, only the order. * @return array{categories: list, tags: list} Names, in * the order given — categories first in the exported CATEGORIES * list, so a reader taking the first entry gets a category. */ public static function partition( array $labels ): array { $split = array( 'categories' => array(), 'tags' => array(), ); foreach ( $labels as $label ) { $split[ $label->isTag() ? 'tags' : 'categories' ][] = $label->name(); } return $split; } }