private static function chooseBestNotifier($notifiers) { /** @var Notifier|null $bestNotifier */ $bestNotifier = null; foreach ($notifiers as $notifier) { if (!$notifier->isSupported()) { continue; } if (null !== $bestNotifier && $bestNotifier->getPriority() >= $notifier->getPriority()) { continue; } $bestNotifier = $notifier; } return $bestNotifier; }