1 | <?php |
||
12 | final class ReaderFactory |
||
13 | { |
||
14 | /** |
||
15 | * @var string[] |
||
16 | */ |
||
17 | private $config; |
||
18 | |||
19 | /** |
||
20 | * @var FileReader[] |
||
21 | */ |
||
22 | private $readers = []; |
||
23 | |||
24 | /** |
||
25 | * @param array $config |
||
26 | */ |
||
27 | public function __construct(array $config) |
||
31 | |||
32 | /** |
||
33 | * @param string $filename |
||
34 | * |
||
35 | * @throws InvalidArgumentException |
||
36 | * |
||
37 | * @return FileReader |
||
38 | */ |
||
39 | public function create($filename) |
||
51 | |||
52 | /** |
||
53 | * @param string $filename |
||
54 | * |
||
55 | * @throws UnknownFileTypeException |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | private function getReaderClass($filename) |
||
79 | |||
80 | /** |
||
81 | * @param string $haystack |
||
82 | * @param string $needle |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | private function endsWith($haystack, $needle) |
||
90 | } |
||
91 |