55use DateTime ;
66use React \EventLoop \LoopInterface ;
77use React \Filesystem \AdapterInterface ;
8- use React \Filesystem \CallInvokerInterface ;
98use React \Filesystem \FilesystemInterface ;
109use React \Filesystem \ModeTypeDetector ;
1110use React \Filesystem \Node \NodeInterface ;
@@ -44,16 +43,6 @@ class Adapter implements AdapterInterface
4443 */
4544 protected $ permissionFlagResolver ;
4645
47- /**
48- * @var CallInvokerInterface
49- */
50- protected $ invoker ;
51-
52- /**
53- * @var CallInvokerInterface
54- */
55- protected $ readDirInvoker ;
56-
5746 /**
5847 * @var FilesystemInterface
5948 */
@@ -96,8 +85,6 @@ public function __construct(LoopInterface $loop, array $options = [])
9685 */
9786 protected function applyConfiguration (array $ options )
9887 {
99- $ this ->invoker = \React \Filesystem \getInvoker ($ this , $ options , 'invoker ' , 'React\Filesystem\InstantInvoker ' );
100- $ this ->readDirInvoker = \React \Filesystem \getInvoker ($ this , $ options , 'read_dir_invoker ' , 'React\Filesystem\InstantInvoker ' );
10188 $ this ->openFileLimiter = new OpenFileLimiter (\React \Filesystem \getOpenFileLimit ($ options ));
10289 $ this ->options = array_merge_recursive ($ this ->options , $ options );
10390 }
@@ -118,14 +105,6 @@ public function getLoop()
118105 return $ this ->loop ;
119106 }
120107
121- /**
122- * {@inheritDoc}
123- */
124- public function setInvoker (CallInvokerInterface $ invoker )
125- {
126- $ this ->invoker = $ invoker ;
127- }
128-
129108 /**
130109 * {@inheritDoc}
131110 */
@@ -139,20 +118,12 @@ public function setFilesystem(FilesystemInterface $filesystem)
139118 ];
140119 }
141120
142- /**
143- * {@inheritDoc}
144- */
145- public function setReadDirInvoker (CallInvokerInterface $ invoker )
146- {
147- $ this ->readDirInvoker = $ invoker ;
148- }
149-
150121 /**
151122 * {@inheritDoc}
152123 */
153124 public function stat ($ filename )
154125 {
155- return $ this ->invoker -> invokeCall ('eio_lstat ' , [$ filename ])->then (function ($ stat ) {
126+ return $ this ->callFilesystem ('eio_lstat ' , [$ filename ])->then (function ($ stat ) {
156127 $ stat ['atime ' ] = new DateTime ('@ ' .$ stat ['atime ' ]);
157128 $ stat ['mtime ' ] = new DateTime ('@ ' .$ stat ['mtime ' ]);
158129 $ stat ['ctime ' ] = new DateTime ('@ ' .$ stat ['ctime ' ]);
@@ -165,31 +136,31 @@ public function stat($filename)
165136 */
166137 public function unlink ($ filename )
167138 {
168- return $ this ->invoker -> invokeCall ('eio_unlink ' , [$ filename ]);
139+ return $ this ->callFilesystem ('eio_unlink ' , [$ filename ]);
169140 }
170141
171142 /**
172143 * {@inheritDoc}
173144 */
174145 public function rename ($ fromFilename , $ toFilename )
175146 {
176- return $ this ->invoker -> invokeCall ('eio_rename ' , [$ fromFilename , $ toFilename ]);
147+ return $ this ->callFilesystem ('eio_rename ' , [$ fromFilename , $ toFilename ]);
177148 }
178149
179150 /**
180151 * {@inheritDoc}
181152 */
182153 public function chmod ($ path , $ mode )
183154 {
184- return $ this ->invoker -> invokeCall ('eio_chmod ' , [$ path , $ mode ]);
155+ return $ this ->callFilesystem ('eio_chmod ' , [$ path , $ mode ]);
185156 }
186157
187158 /**
188159 * {@inheritDoc}
189160 */
190161 public function chown ($ path , $ uid , $ gid )
191162 {
192- return $ this ->invoker -> invokeCall ('eio_chown ' , [$ path , $ uid , $ gid ]);
163+ return $ this ->callFilesystem ('eio_chown ' , [$ path , $ uid , $ gid ]);
193164 }
194165
195166 /**
@@ -208,7 +179,7 @@ public function lsStream($path)
208179 {
209180 $ stream = new ObjectStream ();
210181
211- $ this ->readDirInvoker -> invokeCall ('eio_readdir ' , [$ path , $ this ->options ['lsFlags ' ]], false )->then (function ($ result ) use ($ path , $ stream ) {
182+ $ this ->callFilesystem ('eio_readdir ' , [$ path , $ this ->options ['lsFlags ' ]], false )->then (function ($ result ) use ($ path , $ stream ) {
212183 $ this ->processLsContents ($ path , $ result , $ stream );
213184 });
214185
@@ -250,7 +221,7 @@ protected function processLsContents($basePath, $result, ObjectStream $stream)
250221 */
251222 public function mkdir ($ path , $ mode = self ::CREATION_MODE )
252223 {
253- return $ this ->invoker -> invokeCall ('eio_mkdir ' , [
224+ return $ this ->callFilesystem ('eio_mkdir ' , [
254225 $ path ,
255226 $ this ->permissionFlagResolver ->resolve ($ mode ),
256227 ]);
@@ -261,7 +232,7 @@ public function mkdir($path, $mode = self::CREATION_MODE)
261232 */
262233 public function rmdir ($ path )
263234 {
264- return $ this ->invoker -> invokeCall ('eio_rmdir ' , [$ path ]);
235+ return $ this ->callFilesystem ('eio_rmdir ' , [$ path ]);
265236 }
266237
267238 /**
@@ -272,7 +243,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE)
272243 $ eioFlags = $ this ->openFlagResolver ->resolve ($ flags );
273244 $ mode = $ this ->permissionFlagResolver ->resolve ($ mode );
274245 return $ this ->openFileLimiter ->open ()->then (function () use ($ path , $ eioFlags , $ mode ) {
275- return $ this ->invoker -> invokeCall ('eio_open ' , [
246+ return $ this ->callFilesystem ('eio_open ' , [
276247 $ path ,
277248 $ eioFlags ,
278249 $ mode ,
@@ -288,7 +259,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE)
288259 */
289260 public function close ($ fd )
290261 {
291- return $ this ->invoker -> invokeCall ('eio_close ' , [$ fd ])->always (function () {
262+ return $ this ->callFilesystem ('eio_close ' , [$ fd ])->always (function () {
292263 $ this ->openFileLimiter ->close ();
293264 });
294265 }
@@ -302,14 +273,14 @@ public function touch($path, $mode = self::CREATION_MODE, $time = null)
302273 if ($ time === null ) {
303274 $ time = microtime (true );
304275 }
305- return $ this ->invoker -> invokeCall ('eio_utime ' , [
276+ return $ this ->callFilesystem ('eio_utime ' , [
306277 $ path ,
307278 $ time ,
308279 $ time ,
309280 ]);
310281 }, function () use ($ path , $ mode ) {
311282 return $ this ->openFileLimiter ->open ()->then (function () use ($ path , $ mode ) {
312- return $ this ->invoker -> invokeCall ('eio_open ' , [
283+ return $ this ->callFilesystem ('eio_open ' , [
313284 $ path ,
314285 EIO_O_CREAT ,
315286 $ this ->permissionFlagResolver ->resolve ($ mode ),
@@ -325,7 +296,7 @@ public function touch($path, $mode = self::CREATION_MODE, $time = null)
325296 */
326297 public function read ($ fileDescriptor , $ length , $ offset )
327298 {
328- return $ this ->invoker -> invokeCall ('eio_read ' , [
299+ return $ this ->callFilesystem ('eio_read ' , [
329300 $ fileDescriptor ,
330301 $ length ,
331302 $ offset ,
@@ -337,7 +308,7 @@ public function read($fileDescriptor, $length, $offset)
337308 */
338309 public function write ($ fileDescriptor , $ data , $ length , $ offset )
339310 {
340- return $ this ->invoker -> invokeCall ('eio_write ' , [
311+ return $ this ->callFilesystem ('eio_write ' , [
341312 $ fileDescriptor ,
342313 $ data ,
343314 $ length ,
@@ -350,7 +321,7 @@ public function write($fileDescriptor, $data, $length, $offset)
350321 */
351322 public function readlink ($ path )
352323 {
353- return $ this ->invoker -> invokeCall ('eio_readlink ' , [
324+ return $ this ->callFilesystem ('eio_readlink ' , [
354325 $ path ,
355326 ]);
356327 }
@@ -360,7 +331,7 @@ public function readlink($path)
360331 */
361332 public function symlink ($ fromPath , $ toPath )
362333 {
363- return $ this ->invoker -> invokeCall ('eio_symlink ' , [
334+ return $ this ->callFilesystem ('eio_symlink ' , [
364335 $ fromPath ,
365336 $ toPath ,
366337 ]);
0 commit comments