Skip to content

Commit 9757fbb

Browse files
author
Roman Syroeshko
committed
[FIXED] #340
1 parent 48322ca commit 9757fbb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/PhpWord/IOFactory.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@
1010
namespace PhpOffice\PhpWord;
1111

1212
use PhpOffice\PhpWord\Exception\Exception;
13-
use PhpOffice\PhpWord\Writer\WriterInterface;
1413
use PhpOffice\PhpWord\Reader\ReaderInterface;
14+
use PhpOffice\PhpWord\Writer\WriterInterface;
1515

16-
/**
17-
* IO factory
18-
*/
1916
abstract class IOFactory
2017
{
2118
/**
@@ -24,15 +21,16 @@ abstract class IOFactory
2421
* @param PhpWord $phpWord
2522
* @param string $name
2623
* @return WriterInterface
27-
* @throws Exception
24+
* @throws \PhpOffice\PhpWord\Exception\Exception
2825
*/
2926
public static function createWriter(PhpWord $phpWord, $name = 'Word2007')
3027
{
31-
if ($name !== 'WriterInterface' && $name !== 'ODText' && $name !== 'RTF' && $name !== 'Word2007') {
28+
if ($name !== 'WriterInterface' && !in_array($name, array('ODText', 'RTF', 'Word2007', 'HTML', 'PDF'), true)) {
3229
throw new Exception("\"{$name}\" is not a valid writer.");
3330
}
3431

3532
$fqName = "PhpOffice\\PhpWord\\Writer\\{$name}";
33+
3634
return new $fqName($phpWord);
3735
}
3836

0 commit comments

Comments
 (0)