| 1 | <?php |
||
| 9 | final class ReaderFactory |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string[] |
||
| 13 | */ |
||
| 14 | private $config; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var FileReader[] |
||
| 18 | */ |
||
| 19 | private $readers = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param array $config |
||
| 23 | */ |
||
| 24 | public function __construct(array $config) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param string $filename |
||
| 31 | * |
||
| 32 | * @return FileReader |
||
| 33 | * |
||
| 34 | * @throws InvalidArgumentException |
||
| 35 | */ |
||
| 36 | public function create($filename) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param string $filename |
||
| 51 | * |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | private function getReaderClass($filename) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param string $haystack |
||
| 77 | * @param string $needle |
||
| 78 | * |
||
| 79 | * @return bool |
||
| 80 | */ |
||
| 81 | private function endsWith($haystack, $needle) |
||
| 85 | } |
||
| 86 |