Skip to content

Commit 14065eb

Browse files
author
Charlotte Dunois
committed
Add getters for setters and add fs class method to interface
1 parent 4e2af61 commit 14065eb

14 files changed

+132
-13
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Filesystem
22
==========
33

4-
Evented filesystem access utilizing [EIO](http://php.net/eio).
5-
64
[![Build Status](https://secure.travis-ci.org/reactphp/filesystem.png?branch=master)](http://travis-ci.org/reactphp/filesystem) [![Code Climate](https://codeclimate.com/github/reactphp/filesystem/badges/gpa.svg)](https://codeclimate.com/github/reactphp/filesystem)
75

6+
[ReactPHP](https://reactphp.org/)'s evented asynchronous, non-blocking filesystem access library.
7+
88
Table of Contents
99
-----------------
1010

@@ -23,7 +23,7 @@ Table of Contents
2323
Introduction
2424
------------
2525

26-
Filesystem WIP for [EIO](http://php.net/eio), keep in mind that this can be very unstable at times and is not stable by a long shot!
26+
`react/filesystem` is a package to power your application with asynchronous, non-blocking filesystem access. Asynchronous access is enabled by various adapters described below.
2727

2828
Adapters
2929
------------
@@ -70,7 +70,7 @@ Which is a convenience method for:
7070

7171
```php
7272
$filesystem->file('test.txt')->open('r')->then(function($stream) {
73-
return React\Stream\BufferedSink::createPromise($stream);
73+
return \React\Stream\BufferedSink::createPromise($stream);
7474
})->then(function($contents) {
7575
// ...
7676
});

src/AdapterInterface.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ public static function isSupported();
2424
*/
2525
public function getLoop();
2626

27+
/**
28+
* Get the relevant filesystem for this adapter.
29+
*
30+
* @internal
31+
* @return FilesystemInterface
32+
*/
33+
public function getFilesystem();
34+
35+
/**
36+
* Get the call invoker for this adapter.
37+
*
38+
* @return CallInvokerInterface
39+
*/
40+
public function getInvoker();
41+
2742
/**
2843
* Set the relevant filesystem for this adapter.
2944
*
@@ -143,7 +158,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE);
143158
/**
144159
* Read from the given file descriptor.
145160
*
146-
* @param $fileDescriptor
161+
* @param mixed $fileDescriptor
147162
* @param int $length
148163
* @param int $offset
149164
* @return PromiseInterface
@@ -153,7 +168,7 @@ public function read($fileDescriptor, $length, $offset);
153168
/**
154169
* Write to the given file descriptor.
155170
*
156-
* @param $fileDescriptor
171+
* @param mixed $fileDescriptor
157172
* @param string $data
158173
* @param int $length
159174
* @param int $offset
@@ -164,7 +179,7 @@ public function write($fileDescriptor, $data, $length, $offset);
164179
/**
165180
* Close the given file descriptor.
166181
*
167-
* @param resource $fd
182+
* @param mixed $fd
168183
* @return PromiseInterface
169184
*/
170185
public function close($fd);

src/ChildProcess/Adapter.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ public function getLoop()
132132
return $this->loop;
133133
}
134134

135+
/**
136+
* {@inheritDoc}
137+
*/
138+
public function getFilesystem()
139+
{
140+
return $this->filesystem;
141+
}
142+
135143
/**
136144
* {@inheritDoc}
137145
*/
@@ -145,6 +153,14 @@ public function setFilesystem(FilesystemInterface $filesystem)
145153
];
146154
}
147155

156+
/**
157+
* {@inheritDoc}
158+
*/
159+
public function getInvoker()
160+
{
161+
return $this->invoker;
162+
}
163+
148164
/**
149165
* @param CallInvokerInterface $invoker
150166
* @return void

src/Eio/Adapter.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ public function getLoop()
118118
return $this->loop;
119119
}
120120

121+
/**
122+
* {@inheritDoc}
123+
*/
124+
public function getInvoker()
125+
{
126+
return $this->invoker;
127+
}
128+
121129
/**
122130
* {@inheritDoc}
123131
*/
@@ -126,6 +134,14 @@ public function setInvoker(CallInvokerInterface $invoker)
126134
$this->invoker = $invoker;
127135
}
128136

137+
/**
138+
* {@inheritDoc}
139+
*/
140+
public function getFilesystem()
141+
{
142+
return $this->filesystem;
143+
}
144+
129145
/**
130146
* {@inheritDoc}
131147
*/

src/FilesystemInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public function dir($path);
5151
*/
5252
public function link($path, Node\NodeInterface $destination);
5353

54+
/**
55+
* @param string $path
56+
* @return \React\Promise\PromiseInterface
57+
*/
58+
public function constructLink($path);
59+
5460
/**
5561
* @param string $filename
5662
* @return \React\Promise\PromiseInterface

src/Stream/DuplexStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DuplexStream extends EventEmitter implements DuplexStreamInterface, Generi
1414

1515
/**
1616
* @param string $path
17-
* @param resource $fileDescriptor
17+
* @param mixed $fileDescriptor
1818
* @param AdapterInterface $filesystem
1919
*/
2020
public function __construct($path, $fileDescriptor, AdapterInterface $filesystem)

src/Stream/GenericStreamInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
interface GenericStreamInterface
66
{
77
/**
8-
* @return resource
8+
* @return mixed
99
*/
1010
public function getFiledescriptor();
1111
}

src/Stream/GenericStreamTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait GenericStreamTrait
1313

1414
/**
1515
* @param string $path
16-
* @param resource $fileDescriptor
16+
* @param mixed $fileDescriptor
1717
* @param AdapterInterface $filesystem
1818
*/
1919
public function __construct($path, $fileDescriptor, AdapterInterface $filesystem)

src/Stream/ReadableStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ReadableStream extends EventEmitter implements GenericStreamInterface, Rea
1313

1414
/**
1515
* @param string $path
16-
* @param resource $fileDescriptor
16+
* @param mixed $fileDescriptor
1717
* @param AdapterInterface $filesystem
1818
*/
1919
public function __construct($path, $fileDescriptor, AdapterInterface $filesystem)

src/Stream/StreamFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class StreamFactory
88
{
99
/**
1010
* @param string $path
11-
* @param resource $fileDescriptor
11+
* @param mixed $fileDescriptor
1212
* @param int $flags
1313
* @param AdapterInterface $filesystem
1414
* @return DuplexStream|ReadableStream|WritableStream

0 commit comments

Comments
 (0)