@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | class StreamsTest extends TestCase |
18 | 18 | { |
19 | - private const FIXTURE_DIRECTORY = __DIR__ . '/fixtures'; |
|
19 | + private const FIXTURE_DIRECTORY = __DIR__.'/fixtures'; |
|
20 | 20 | |
21 | 21 | public function setUp(): void |
22 | 22 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->assertSame(strlen('sample text'), filesize($filename)); |
42 | 42 | $this->assertSame(md5('sample text'), md5_file($filename)); |
43 | 43 | |
44 | - $newFilename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
44 | + $newFilename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
45 | 45 | copy($filename, $newFilename); |
46 | 46 | |
47 | 47 | $this->assertFileExists($newFilename); |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | |
80 | 80 | public function testException() |
81 | 81 | { |
82 | - try { |
|
82 | + try{ |
|
83 | 83 | fopen('spiral://non-exists', 'rb'); |
84 | - } catch (\Throwable $e) { |
|
84 | + }catch (\Throwable $e){ |
|
85 | 85 | $this->assertStringContainsString('failed to open stream', $e->getMessage()); |
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - try { |
|
89 | + try{ |
|
90 | 90 | filemtime('spiral://non-exists'); |
91 | - } catch (\Throwable $e) { |
|
91 | + }catch (\Throwable $e){ |
|
92 | 92 | $this->assertStringContainsString('stat failed', $e->getMessage()); |
93 | 93 | } |
94 | 94 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function stream_open($path, $mode, $options, &$opened_path) |
73 | 73 | { |
74 | - if (!isset(self::$uris[$path])) { |
|
74 | + if (!isset(self::$uris[$path])){ |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function url_stat($path, $flags) |
157 | 157 | { |
158 | - if (!isset(self::$uris[$path])) { |
|
158 | + if (!isset(self::$uris[$path])){ |
|
159 | 159 | return null; |
160 | 160 | } |
161 | 161 | |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | private function getStreamStats(StreamInterface $stream) |
172 | 172 | { |
173 | 173 | $mode = $this->mode; |
174 | - if (empty($mode)) { |
|
175 | - if ($stream->isReadable()) { |
|
174 | + if (empty($mode)){ |
|
175 | + if ($stream->isReadable()){ |
|
176 | 176 | $mode = 'r'; |
177 | 177 | } |
178 | 178 | |
179 | - if ($stream->isWritable()) { |
|
179 | + if ($stream->isWritable()){ |
|
180 | 180 | $mode = !empty($mode) ? 'r+' : 'w'; |
181 | 181 | } |
182 | 182 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function register() |
205 | 205 | { |
206 | - if (self::$registered) { |
|
206 | + if (self::$registered){ |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function has($file) |
221 | 221 | { |
222 | - if ($file instanceof StreamInterface) { |
|
223 | - $file = 'spiral://' . spl_object_hash($file); |
|
222 | + if ($file instanceof StreamInterface){ |
|
223 | + $file = 'spiral://'.spl_object_hash($file); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return isset(self::$uris[$file]); |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | public static function getResource(StreamInterface $stream) |
238 | 238 | { |
239 | 239 | $mode = null; |
240 | - if ($stream->isReadable()) { |
|
240 | + if ($stream->isReadable()){ |
|
241 | 241 | $mode = 'r'; |
242 | 242 | } |
243 | 243 | |
244 | - if ($stream->isWritable()) { |
|
244 | + if ($stream->isWritable()){ |
|
245 | 245 | $mode = !empty($mode) ? 'r+' : 'w'; |
246 | 246 | } |
247 | 247 | |
248 | - if (empty($mode)) { |
|
248 | + if (empty($mode)){ |
|
249 | 249 | throw new WrapperException("Stream is not available in read or write modes"); |
250 | 250 | } |
251 | 251 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | { |
263 | 263 | self::register(); |
264 | 264 | |
265 | - $uri = 'spiral://' . spl_object_hash($stream); |
|
265 | + $uri = 'spiral://'.spl_object_hash($stream); |
|
266 | 266 | self::$uris[$uri] = $stream; |
267 | 267 | |
268 | 268 | return $uri; |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public static function release($file) |
278 | 278 | { |
279 | - if ($file instanceof StreamInterface) { |
|
280 | - $file = 'spiral://' . spl_object_hash($file); |
|
279 | + if ($file instanceof StreamInterface){ |
|
280 | + $file = 'spiral://'.spl_object_hash($file); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | unset(self::$uris[$file]); |