@@ -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 | } |
@@ -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 | } |
@@ -15,100 +15,100 @@ |
||
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 closeProvider() |
38 | 38 | { |
39 | 39 | return [ |
40 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt")], |
|
41 | - [new StringInputStream("a\n")] |
|
40 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt") ], |
|
41 | + [ new StringInputStream("a\n") ] |
|
42 | 42 | ]; |
43 | 43 | } |
44 | 44 | |
45 | 45 | public function skipProvider() |
46 | 46 | { |
47 | 47 | return [ |
48 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "a", 0], |
|
49 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "b", 1], |
|
50 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "d", 3], |
|
51 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "f", 5], |
|
52 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "\n", 9], |
|
53 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "", 10], |
|
54 | - [new StringInputStream("abcdefghi"), "a", 0], |
|
55 | - [new StringInputStream("abcdefghi"), "b", 1], |
|
56 | - [new StringInputStream("abcdefghi"), "d", 3], |
|
57 | - [new StringInputStream("abcdefghi"), "f", 5], |
|
58 | - [new StringInputStream("abcdefghi"), "", 9], |
|
59 | - [new StringInputStream("abcdefghi"), "", 10] |
|
48 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "a", 0 ], |
|
49 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "b", 1 ], |
|
50 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "d", 3 ], |
|
51 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "f", 5 ], |
|
52 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "\n", 9 ], |
|
53 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test4.txt"), "", 10 ], |
|
54 | + [ new StringInputStream("abcdefghi"), "a", 0 ], |
|
55 | + [ new StringInputStream("abcdefghi"), "b", 1 ], |
|
56 | + [ new StringInputStream("abcdefghi"), "d", 3 ], |
|
57 | + [ new StringInputStream("abcdefghi"), "f", 5 ], |
|
58 | + [ new StringInputStream("abcdefghi"), "", 9 ], |
|
59 | + [ new StringInputStream("abcdefghi"), "", 10 ] |
|
60 | 60 | ]; |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function overSkipAndReadProvider() |
64 | 64 | { |
65 | 65 | return [ |
66 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test5.txt"), 4], |
|
67 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test6.txt"), 100], |
|
68 | - [new StringInputStream("abc\n"), 4], |
|
69 | - [new StringInputStream("abcde\nあいうえお"), 100] |
|
66 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test5.txt"), 4 ], |
|
67 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test6.txt"), 100 ], |
|
68 | + [ new StringInputStream("abc\n"), 4 ], |
|
69 | + [ new StringInputStream("abcde\nあいうえお"), 100 ] |
|
70 | 70 | ]; |
71 | 71 | } |
72 | 72 | |
73 | 73 | public function frontSkipProvider() |
74 | 74 | { |
75 | 75 | return [ |
76 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test8.txt"), 3, -1, "c"], |
|
77 | - [new StringInputStream("abcde\n"), 3, -1, "c"] |
|
76 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test8.txt"), 3, -1, "c" ], |
|
77 | + [ new StringInputStream("abcde\n"), 3, -1, "c" ] |
|
78 | 78 | ]; |
79 | 79 | } |
80 | 80 | |
81 | 81 | public function overFrontSkipProvider() |
82 | 82 | { |
83 | 83 | return [ |
84 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -1], |
|
85 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -100], |
|
86 | - [new StringInputStream("a\n"), -1], |
|
87 | - [new StringInputStream("a\n"), -100] |
|
84 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -1 ], |
|
85 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), -100 ], |
|
86 | + [ new StringInputStream("a\n"), -1 ], |
|
87 | + [ new StringInputStream("a\n"), -100 ] |
|
88 | 88 | ]; |
89 | 89 | } |
90 | 90 | |
91 | 91 | public function resetProvider() |
92 | 92 | { |
93 | 93 | return [ |
94 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), 1, "a"], |
|
95 | - [new StringInputStream("a\n"), 1, "a"] |
|
94 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), 1, "a" ], |
|
95 | + [ new StringInputStream("a\n"), 1, "a" ] |
|
96 | 96 | ]; |
97 | 97 | } |
98 | 98 | |
99 | 99 | public function markAndResetProvider() |
100 | 100 | { |
101 | 101 | return [ |
102 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test7.txt"), 3, "d"], |
|
103 | - [new StringInputStream("abcde\n"), 3, "d"] |
|
102 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test7.txt"), 3, "d" ], |
|
103 | + [ new StringInputStream("abcde\n"), 3, "d" ] |
|
104 | 104 | ]; |
105 | 105 | } |
106 | 106 | |
107 | 107 | public function invalidLengthProvider() |
108 | 108 | { |
109 | 109 | return [ |
110 | - [new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a"], |
|
111 | - [new StringInputStream("a\n"), "a"] |
|
110 | + [ new FileInputStream(dirname(__FILE__) . "/../Fixtures/inputstreamreader-test1.txt"), "a" ], |
|
111 | + [ new StringInputStream("a\n"), "a" ] |
|
112 | 112 | ]; |
113 | 113 | } |
114 | 114 | } |
@@ -14,42 +14,42 @@ |
||
14 | 14 | public function fileProvider() |
15 | 15 | { |
16 | 16 | return [ |
17 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt")] |
|
17 | + [ new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt") ] |
|
18 | 18 | ]; |
19 | 19 | } |
20 | 20 | |
21 | 21 | public function directoryProvider() |
22 | 22 | { |
23 | 23 | return [ |
24 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test/")] |
|
24 | + [ new File(dirname(__FILE__) . "/../Fixtures/file-test/") ] |
|
25 | 25 | ]; |
26 | 26 | } |
27 | 27 | |
28 | 28 | public function fileLinkProvider() |
29 | 29 | { |
30 | 30 | return [ |
31 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt"), "/tmp/file-test-link"] |
|
31 | + [ new File(dirname(__FILE__) . "/../Fixtures/file-test1.txt"), "/tmp/file-test-link" ] |
|
32 | 32 | ]; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function tmpFileProvider() |
36 | 36 | { |
37 | 37 | return [ |
38 | - [new File("/tmp/file-test-tmp.txt")] |
|
38 | + [ new File("/tmp/file-test-tmp.txt") ] |
|
39 | 39 | ]; |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function tmpDirectoryProvider() |
43 | 43 | { |
44 | 44 | return [ |
45 | - [new File("/tmp/file-test-tmp/")] |
|
45 | + [ new File("/tmp/file-test-tmp/") ] |
|
46 | 46 | ]; |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function renameFailureProvider() |
50 | 50 | { |
51 | 51 | return [ |
52 | - [new File(dirname(__FILE__) . "/../Fixtures/file-test/file-test2.txt")] |
|
52 | + [ new File(dirname(__FILE__) . "/../Fixtures/file-test/file-test2.txt") ] |
|
53 | 53 | ]; |
54 | 54 | } |
55 | 55 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function writeProvider() |
16 | 16 | { |
17 | 17 | return [ |
18 | - ["/tmp/outputstreamwriter-test1.txt"] |
|
18 | + [ "/tmp/outputstreamwriter-test1.txt" ] |
|
19 | 19 | ]; |
20 | 20 | } |
21 | 21 | } |