Joli\JoliNotif\NotifierFactory::createOrThrowException PHP Method

createOrThrowException() public static method

public static createOrThrowException ( array $notifiers = [] ) : Joli\JoliNotif\Notifier
$notifiers array
return Joli\JoliNotif\Notifier
    public static function createOrThrowException(array $notifiers = [])
    {
        if (empty($notifiers)) {
            $notifiers = static::getDefaultNotifiers();
        }
        $bestNotifier = self::chooseBestNotifier($notifiers);
        if (null === $bestNotifier) {
            throw new NoSupportedNotifierException();
        }
        return $bestNotifier;
    }

Usage Example

 /** @expectedException \Joli\JoliNotif\Exception\NoSupportedNotifierException */
 public function testCreateOrThrowExceptionWithNoSupportedNotifiersThrowsException()
 {
     NotifierFactory::createOrThrowException([new ConfigurableNotifier(false), new ConfigurableNotifier(false)]);
 }