| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public static function make(array $config): NotifierInterface |
||
| 16 | { |
||
| 17 | $driver = $config['default']; |
||
| 18 | |||
| 19 | if (!isset($config[$driver])) { |
||
| 20 | throw new RuntimeException('Unknown "'.$driver.'" notification driver.'); |
||
| 21 | } |
||
| 22 | |||
| 23 | $class = $config[$driver]['class']; |
||
| 24 | |||
| 25 | if (!class_exists($class)) { |
||
| 26 | throw new RuntimeException('class "'.$class.'" does not exists.'); |
||
| 27 | } |
||
| 28 | |||
| 29 | return new $class($config[$driver]); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |