1 | <?php |
||
2 | |||
3 | namespace WebStream\IO\Reader; |
||
4 | |||
5 | use WebStream\Exception\Extend\InvalidArgumentException; |
||
0 ignored issues
–
show
|
|||
6 | use WebStream\Exception\Extend\IOException; |
||
0 ignored issues
–
show
The type
WebStream\Exception\Extend\IOException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
7 | use WebStream\IO\InputStream; |
||
8 | |||
9 | /** |
||
10 | * InputStreamReader |
||
11 | * @author Ryuichi TANAKA. |
||
12 | * @since 2016/02/05 |
||
13 | * @version 0.7 |
||
14 | */ |
||
15 | class InputStreamReader |
||
16 | { |
||
17 | /** |
||
18 | * @var InputStream 入力ストリーム |
||
19 | */ |
||
20 | protected InputStream $stream; |
||
21 | |||
22 | /** |
||
23 | * constructor |
||
24 | * @param InputStream $stream 入力ストリーム |
||
25 | */ |
||
26 | 51 | public function __construct(InputStream $stream) |
|
27 | { |
||
28 | 51 | $this->stream = $stream; |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * destructor |
||
33 | */ |
||
34 | 51 | public function __destruct() |
|
35 | { |
||
36 | 51 | $this->close(); |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * 読み込んでいる入力ストリームを閉じる |
||
41 | */ |
||
42 | 51 | public function close() |
|
43 | { |
||
44 | 51 | $this->stream->close(); |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * 入力ストリームからデータを読み込む |
||
49 | * @return string 読み込みデータ |
||
50 | * @throws InvalidArgumentException |
||
51 | * @throws IOException |
||
52 | */ |
||
53 | 34 | public function read() |
|
54 | { |
||
55 | 34 | $args = func_get_args(); |
|
56 | 34 | $length = count($args) === 1 ? $args[0] : 0; |
|
57 | |||
58 | 34 | if (!is_int($length)) { |
|
59 | 2 | throw new InvalidArgumentException("Invalid read size."); |
|
60 | } |
||
61 | |||
62 | 32 | return $this->stream->read($length); |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * 入力ストリームから行単位でデータを読み込む |
||
67 | * 末尾に改行コードは含まない |
||
68 | * @return string 読み込みデータ |
||
69 | */ |
||
70 | 2 | public function readLine() |
|
71 | { |
||
72 | 2 | return $this->stream->readLine(); |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * 入力ストリームから指定バイト数後方へポインタを移動する |
||
77 | * @param int $pos 後方への移動バイト数(負数の場合は前方へ移動) |
||
78 | * @return int $skipNum 移動したバイト数、移動に失敗した場合-1 |
||
79 | */ |
||
80 | 26 | public function skip(int $pos) |
|
81 | { |
||
82 | 26 | return $this->stream->skip($pos); |
|
83 | } |
||
84 | |||
85 | /** |
||
86 | * 最後にmarkされた位置に再配置する |
||
87 | * @throws IOException |
||
88 | */ |
||
89 | 4 | public function reset() |
|
90 | { |
||
91 | 4 | $this->stream->reset(); |
|
92 | } |
||
93 | |||
94 | /** |
||
95 | * 入力ストリームの現在位置にmarkを設定する |
||
96 | * @param int マークするバイト位置 |
||
0 ignored issues
–
show
|
|||
97 | * @throws IOException |
||
98 | */ |
||
99 | 2 | public function mark() |
|
100 | { |
||
101 | 2 | $this->stream->mark(); |
|
102 | } |
||
103 | } |
||
104 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths