We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 002fc42 commit a35259fCopy full SHA for a35259f
1 file changed
bin/import.php
@@ -7,18 +7,20 @@
7
8
$importer = ImporterFactory::create();
9
10
-if ($argc <= 1) {
11
- throw new RuntimeException('Missing input filename');
12
-}
+if ($argc > 1) {
+ foreach (array_splice($argv, 1) as $file) {
+ if (!is_readable($file)) {
13
+ throw new RuntimeException("{$file} isn't readable");
14
+ }
15
-$filename = $argv[1];
-if (!is_readable($filename)) {
16
- throw new RuntimeException($filename . ' isn\'t readable');
+ $fp = fopen($file, 'r');
17
+ if (!$fp) {
18
+ throw new RuntimeException("Can't open {$file}");
19
20
+ $importer->import($fp);
21
+ fclose($fp);
22
23
+} else {
24
+ $importer->import(STDIN);
25
}
26
-$fp = fopen($filename, 'r');
-if (!$fp) {
- throw new RuntimeException('Can\'t open ' . $filename);
-$importer->import($fp);
-fclose($fp);
0 commit comments