@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * constructor |
| 33 | - * @param string $filepath ファイルパス |
|
| 33 | + * @param string $filePath ファイルパス |
|
| 34 | 34 | */ |
| 35 | 35 | public function __construct(string $filePath) |
| 36 | 36 | { |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace WebStream\IO; |
| 3 | 3 | |
| 4 | 4 | use WebStream\Exception\Extend\InvalidArgumentException; |
| 5 | -use WebStream\Exception\Extend\IOException; |
|
| 6 | 5 | |
| 7 | 6 | /** |
| 8 | 7 | * StringInputStream |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | public function writeProvider() |
| 13 | 13 | { |
| 14 | 14 | return [ |
| 15 | - ["/tmp/filewriter-test1.txt", "test"] |
|
| 15 | + [ "/tmp/filewriter-test1.txt", "test" ] |
|
| 16 | 16 | ]; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function writeAppendProvider() |
| 20 | 20 | { |
| 21 | 21 | return [ |
| 22 | - ["/tmp/filewriter-test2.txt", "test", "testtest"] |
|
| 22 | + [ "/tmp/filewriter-test2.txt", "test", "testtest" ] |
|
| 23 | 23 | ]; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | public function readProvider() |
| 13 | 13 | { |
| 14 | 14 | return [ |
| 15 | - [dirname(__FILE__) . "/../Fixtures/filereader-test1.txt", "test1\n" . "test2\n"] |
|
| 15 | + [ dirname(__FILE__) . "/../Fixtures/filereader-test1.txt", "test1\n" . "test2\n" ] |
|
| 16 | 16 | ]; |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -15,84 +15,84 @@ |
||
| 15 | 15 | public function readCharProvider() |
| 16 | 16 | { |
| 17 | 17 | return [ |
| 18 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a", 1], |
|
| 19 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a\n", 100], // over eof |
|
| 20 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ", 3], |
|
| 21 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ\n", 100], // over eof |
|
| 22 | - [new StringInputStream("a"), "a", 1], |
|
| 23 | - [new StringInputStream("a"), "a", 100], // over eof |
|
| 24 | - [new StringInputStream("あ"), "あ", 3], |
|
| 25 | - [new StringInputStream("あ"), "あ", 100] // over eof |
|
| 18 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a", 1 ], |
|
| 19 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a\n", 100 ], // over eof |
|
| 20 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ", 3 ], |
|
| 21 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test2.txt"), "あ\n", 100 ], // over eof |
|
| 22 | + [ new StringInputStream("a"), "a", 1 ], |
|
| 23 | + [ new StringInputStream("a"), "a", 100 ], // over eof |
|
| 24 | + [ new StringInputStream("あ"), "あ", 3 ], |
|
| 25 | + [ new StringInputStream("あ"), "あ", 100 ] // over eof |
|
| 26 | 26 | ]; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | public function readLineProvider() |
| 30 | 30 | { |
| 31 | 31 | return [ |
| 32 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test3.txt"), "test1", "test2"], |
|
| 33 | - [new StringInputStream("test1\ntest2\n"), "test1", "test2"] |
|
| 32 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test3.txt"), "test1", "test2" ], |
|
| 33 | + [ new StringInputStream("test1\ntest2\n"), "test1", "test2" ] |
|
| 34 | 34 | ]; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function skipProvider() |
| 38 | 38 | { |
| 39 | 39 | return [ |
| 40 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "a", 0], |
|
| 41 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "b", 1], |
|
| 42 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "d", 3], |
|
| 43 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "f", 5], |
|
| 44 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "\n", 9], |
|
| 45 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "", 10], |
|
| 46 | - [new StringInputStream("abcdefghi"), "a", 0], |
|
| 47 | - [new StringInputStream("abcdefghi"), "b", 1], |
|
| 48 | - [new StringInputStream("abcdefghi"), "d", 3], |
|
| 49 | - [new StringInputStream("abcdefghi"), "f", 5], |
|
| 50 | - [new StringInputStream("abcdefghi"), "", 9], |
|
| 51 | - [new StringInputStream("abcdefghi"), "", 10] |
|
| 40 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "a", 0 ], |
|
| 41 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "b", 1 ], |
|
| 42 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "d", 3 ], |
|
| 43 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "f", 5 ], |
|
| 44 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "\n", 9 ], |
|
| 45 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "", 10 ], |
|
| 46 | + [ new StringInputStream("abcdefghi"), "a", 0 ], |
|
| 47 | + [ new StringInputStream("abcdefghi"), "b", 1 ], |
|
| 48 | + [ new StringInputStream("abcdefghi"), "d", 3 ], |
|
| 49 | + [ new StringInputStream("abcdefghi"), "f", 5 ], |
|
| 50 | + [ new StringInputStream("abcdefghi"), "", 9 ], |
|
| 51 | + [ new StringInputStream("abcdefghi"), "", 10 ] |
|
| 52 | 52 | ]; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function overSkipAndReadProvider() |
| 56 | 56 | { |
| 57 | 57 | return [ |
| 58 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test5.txt"), 4, null], |
|
| 59 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test6.txt"), 100, null], |
|
| 60 | - [new StringInputStream("abc\n"), 4, null], |
|
| 61 | - [new StringInputStream("abcde\nあいうえお"), 100, null] |
|
| 58 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test5.txt"), 4, null ], |
|
| 59 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test6.txt"), 100, null ], |
|
| 60 | + [ new StringInputStream("abc\n"), 4, null ], |
|
| 61 | + [ new StringInputStream("abcde\nあいうえお"), 100, null ] |
|
| 62 | 62 | ]; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function overFrontSkipProvider() |
| 66 | 66 | { |
| 67 | 67 | return [ |
| 68 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -1], |
|
| 69 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -100], |
|
| 70 | - [new StringInputStream("a\n"), -1], |
|
| 71 | - [new StringInputStream("a\n"), -100] |
|
| 68 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -1 ], |
|
| 69 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -100 ], |
|
| 70 | + [ new StringInputStream("a\n"), -1 ], |
|
| 71 | + [ new StringInputStream("a\n"), -100 ] |
|
| 72 | 72 | ]; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function resetProvider() |
| 76 | 76 | { |
| 77 | 77 | return [ |
| 78 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), 1, "a"], |
|
| 79 | - [new StringInputStream("a\n"), 1, "a"] |
|
| 78 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), 1, "a" ], |
|
| 79 | + [ new StringInputStream("a\n"), 1, "a" ] |
|
| 80 | 80 | ]; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function markAndResetProvider() |
| 84 | 84 | { |
| 85 | 85 | return [ |
| 86 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test7.txt"), 3, "d"], |
|
| 87 | - [new StringInputStream("abcde\n"), 3, "d"] |
|
| 86 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test7.txt"), 3, "d" ], |
|
| 87 | + [ new StringInputStream("abcde\n"), 3, "d" ] |
|
| 88 | 88 | ]; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function invalidLengthProvider() |
| 92 | 92 | { |
| 93 | 93 | return [ |
| 94 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a"], |
|
| 95 | - [new StringInputStream("a\n"), "a"] |
|
| 94 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a" ], |
|
| 95 | + [ new StringInputStream("a\n"), "a" ] |
|
| 96 | 96 | ]; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public function read() |
| 49 | 49 | { |
| 50 | 50 | $args = func_get_args(); |
| 51 | - $length = count($args) === 1 ? $args[0] : null; |
|
| 51 | + $length = count($args) === 1 ? $args[ 0 ] : null; |
|
| 52 | 52 | |
| 53 | 53 | return $this->stream->read($length); |
| 54 | 54 | } |
@@ -51,8 +51,8 @@ |
||
| 51 | 51 | public function write($buf) |
| 52 | 52 | { |
| 53 | 53 | $args = func_get_args(); |
| 54 | - $off = array_key_exists(1, $args) ? $args[1] : null; |
|
| 55 | - $len = array_key_exists(2, $args) ? $args[2] : null; |
|
| 54 | + $off = array_key_exists(1, $args) ? $args[ 1 ] : null; |
|
| 55 | + $len = array_key_exists(2, $args) ? $args[ 2 ] : null; |
|
| 56 | 56 | |
| 57 | 57 | $this->stream->write($buf, $off, $len); |
| 58 | 58 | } |