public function onListBearers(ListBearersEvent $event)
 {
     $filterBadge = $event->getBadge();
     if ($filterBadge instanceof BadgeInterface) {
         $countMethod = $this->badges[$filterBadge->getName()]['counter'];
         $count = $this->{$countMethod}($filterBadge->getData());
         $event->setCount($filterBadge, $count);
     } else {
         foreach ($this->badges as $name => $badge) {
             $countMethod = $badge['counter'];
             $count = $this->{$countMethod}();
             $badge = new Badge($this->getName(), $name);
             $event->setCount($badge, $count);
         }
     }
 }
 public function onListBearers(ListBearersEvent $event)
 {
     if (!$this->security->isGranted(self::FEATURE_FLAG)) {
         return;
     }
     $filterBadge = $event->getBadge();
     if ($filterBadge instanceof BadgeInterface) {
         $countMethod = $this->badges[$filterBadge->getName()]['counter'];
         $count = $this->{$countMethod}($filterBadge->getData());
         $event->setCount($filterBadge, $count);
     } else {
         foreach ($this->badges as $name => $badge) {
             $countMethod = $badge['counter'];
             $count = $this->{$countMethod}();
             $badge = new Badge($this->getName(), $name);
             $event->setCount($badge, $count);
         }
     }
 }