original_string: public function addInvitationsMenuItem(UserMenuCollectionEvent $event): void
      {
          // Get the menu from the event.
          $menu = $event->getMenu();
  
          // Lookup and count pending invitations.
          $repo = $this->em->getRepository(Invitation::class);
          $user = $this->token_storage->getToken()->getUser();
          $invitations = $repo->findPendingInvitations($user);
  
          // Create the pending invitations menu link.
          $invitations = $this->factory->createItem('menu_item.pending_invitations', [
              'route' => 'bkstg_invitation_index',
              'extras' => [
                  'badge_count' => count($invitations),
                  'translation_domain' => BkstgScheduleBundle::TRANSLATION_DOMAIN,
              ],
          ]);
          $menu->addChild($invitations);
      }
code: public function addInvitationsMenuItem(UserMenuCollectionEvent $event): void
      {
          // Get the menu from the event.
          $menu = $event->getMenu();
  
          // Lookup and count pending invitations.
          $repo = $this->em->getRepository(Invitation::class);
          $user = $this->token_storage->getToken()->getUser();
          $invitations = $repo->findPendingInvitations($user);
  
          // Create the pending invitations menu link.
          $invitations = $this->factory->createItem('menu_item.pending_invitations', [
              'route' => 'bkstg_invitation_index',
              'extras' => [
                  'badge_count' => count($invitations),
                  'translation_domain' => BkstgScheduleBundle::TRANSLATION_DOMAIN,
              ],
          ]);
          $menu->addChild($invitations);
      }
code_tokens: public function addInvitationsMenuItem ( UserMenuCollectionEvent $ event ) : void { // Get the menu from the event. $ menu = $ event -> getMenu ( ) ; // Lookup and count pending invitations. $ repo = $ this -> em -> getRepository ( Invitation :: class ) ; $ user = $ this -> token_storage -> getToken ( ) -> getUser ( ) ; $ invitations = $ repo -> findPendingInvitations ( $ user ) ; // Create the pending invitations menu link. $ invitations = $ this -> factory -> createItem ( 'menu_item.pending_invitations' , [ 'route' => 'bkstg_invitation_index' , 'extras' => [ 'badge_count' => count ( $ invitations ) , 'translation_domain' => BkstgScheduleBundle :: TRANSLATION_DOMAIN , ] , ] ) ; $ menu -> addChild ( $ invitations ) ; }
docstring: Add invitations menu item.
  
  @param UserMenuCollectionEvent $event The menu collection event.
  
  @return void
docstring_tokens: Add invitations menu item .