| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public static function create($postType, $config, $throwExceptionOnInvalidWriter = false) |
||
| 23 | { |
||
| 24 | $className = 'Fillet\\Writer\\' . ucfirst($postType) . 'Writer'; |
||
| 25 | if(class_exists($className)) { |
||
| 26 | /** @var WriterInterface $writer */ |
||
| 27 | $writer = new $className($config['destinationFolders'][$postType], $config); |
||
| 28 | return $writer; |
||
| 29 | } |
||
| 30 | |||
| 31 | if($throwExceptionOnInvalidWriter) { |
||
| 32 | throw new \Exception('There is no writer for ' . $postType); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |