Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
26 | 21 | public function getFormatClass(string $path): IFileFormat |
|
27 | { |
||
28 | 21 | if (!class_exists($path)) { |
|
29 | 1 | throw new MapperException(sprintf('Wanted class *%s* not exists!', $path)); |
|
30 | } |
||
31 | 20 | $instance = new $path(); |
|
32 | 20 | if (!$instance instanceof IFileFormat) { |
|
33 | 1 | throw new MapperException(sprintf('Defined class *%s* is not instance of IFileFormat!', $path)); |
|
34 | } |
||
35 | 19 | return $instance; |
|
36 | } |
||
38 |