3
3
namespace React \Filesystem ;
4
4
5
5
use DateTime ;
6
+ use LogicException ;
6
7
use React \Filesystem \Node \NodeInterface ;
7
- use React \Filesystem \Stream \StreamFactory ;
8
- use React \Promise \FulfilledPromise ;
9
8
use React \Promise \PromiseInterface ;
10
- use React \Promise \RejectedPromise ;
11
- use WyriHaximus \React \ChildProcess \Messenger \Messages \Factory ;
12
- use WyriHaximus \React \ChildProcess \Messenger \Messenger ;
13
9
14
10
abstract class AbstractSyncAdapter implements AdapterInterface
15
11
{
@@ -123,8 +119,6 @@ protected function processLsContents($basePath, $result, ObjectStream $stream)
123
119
];
124
120
$ promises [] = \React \Filesystem \detectType ($ this ->typeDetectors , $ node )->then (function (NodeInterface $ node ) use ($ stream ) {
125
121
$ stream ->write ($ node );
126
-
127
- return new FulfilledPromise ();
128
122
});
129
123
}
130
124
@@ -154,19 +148,7 @@ public function touch($path, $mode = self::CREATION_MODE)
154
148
*/
155
149
public function open ($ path , $ flags , $ mode = self ::CREATION_MODE )
156
150
{
157
- return new RejectedPromise ();
158
- $ id = null ;
159
- return \WyriHaximus \React \ChildProcess \Messenger \Factory::parentFromClass (self ::CHILD_CLASS_NAME , $ this ->loop )->then (function (Messenger $ messenger ) use (&$ id , $ path , $ flags , $ mode ) {
160
- $ id = count ($ this ->fileDescriptors );
161
- $ this ->fileDescriptors [$ id ] = $ messenger ;
162
- return $ this ->fileDescriptors [$ id ]->rpc (Factory::rpc ('open ' , [
163
- 'path ' => $ path ,
164
- 'flags ' => $ flags ,
165
- 'mode ' => $ mode ,
166
- ]));
167
- })->then (function () use ($ path , $ flags , &$ id ) {
168
- return \React \Promise \resolve (StreamFactory::create ($ path , $ id , $ flags , $ this ));
169
- });
151
+ return \React \Promise \reject (new LogicException ('Not implemented ' ));
170
152
}
171
153
172
154
/**
@@ -177,13 +159,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE)
177
159
*/
178
160
public function read ($ fileDescriptor , $ length , $ offset )
179
161
{
180
- return new RejectedPromise ();
181
- return $ this ->fileDescriptors [$ fileDescriptor ]->rpc (Factory::rpc ('read ' , [
182
- 'length ' => $ length ,
183
- 'offset ' => $ offset ,
184
- ]))->then (function ($ payload ) {
185
- return \React \Promise \resolve ($ payload ['chunk ' ]);
186
- });
162
+ return \React \Promise \reject (new LogicException ('Not implemented ' ));
187
163
}
188
164
189
165
/**
@@ -195,12 +171,7 @@ public function read($fileDescriptor, $length, $offset)
195
171
*/
196
172
public function write ($ fileDescriptor , $ data , $ length , $ offset )
197
173
{
198
- return new RejectedPromise ();
199
- return $ this ->fileDescriptors [$ fileDescriptor ]->rpc (Factory::rpc ('write ' , [
200
- 'chunk ' => $ data ,
201
- 'length ' => $ length ,
202
- 'offset ' => $ offset ,
203
- ]));
174
+ return \React \Promise \reject (new LogicException ('Not implemented ' ));
204
175
}
205
176
206
177
/**
@@ -209,14 +180,7 @@ public function write($fileDescriptor, $data, $length, $offset)
209
180
*/
210
181
public function close ($ fd )
211
182
{
212
- return new RejectedPromise ();
213
- $ fileDescriptor = $ this ->fileDescriptors [$ fd ];
214
- unset($ this ->fileDescriptors [$ fd ]);
215
- return $ fileDescriptor ->rpc (Factory::rpc ('close ' ))->then (function () use ($ fileDescriptor ) {
216
- return $ fileDescriptor ->softTerminate ();
217
- }, function () use ($ fileDescriptor ) {
218
- return $ fileDescriptor ->softTerminate ();
219
- });
183
+ return \React \Promise \reject (new LogicException ('Not implemented ' ));
220
184
}
221
185
222
186
/**
0 commit comments