Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove call invoker related classes #65

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ public function getLoop();
*/
public function getFilesystem();

/**
* Get the call invoker for this adapter.
*
* @return CallInvokerInterface
*/
public function getInvoker();

/**
* Set the relevant filesystem for this adapter.
*
Expand All @@ -48,14 +41,6 @@ public function getInvoker();
*/
public function setFilesystem(FilesystemInterface $filesystem);

/**
* Set the call invoker for this adapter.
*
* @param CallInvokerInterface $invoker
* @return void
*/
public function setInvoker(CallInvokerInterface $invoker);

/**
* Call the underlying filesystem.
*
Expand Down
32 changes: 0 additions & 32 deletions src/CallInvokerInterface.php

This file was deleted.

52 changes: 14 additions & 38 deletions src/ChildProcess/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use React\Filesystem\ObjectStream;
use React\Filesystem\ObjectStreamSink;
use React\Filesystem\AdapterInterface;
use React\Filesystem\CallInvokerInterface;
use React\Filesystem\FilesystemInterface;
use React\Filesystem\MappedTypeDetector;
use React\Filesystem\ModeTypeDetector;
Expand Down Expand Up @@ -65,11 +64,6 @@ class Adapter implements AdapterInterface
*/
protected $permissionFlagResolver;

/**
* @var CallInvokerInterface
*/
protected $invoker;

/**
* @var array
*/
Expand All @@ -86,7 +80,6 @@ public function __construct(LoopInterface $loop, array $options = [])
{
$this->loop = $loop;

$this->invoker = \React\Filesystem\getInvoker($this, $options, 'invoker', 'React\Filesystem\InstantInvoker');
$this->openFileLimiter = new OpenFileLimiter(\React\Filesystem\getOpenFileLimit($options));
$this->permissionFlagResolver = new PermissionFlagResolver();

Expand Down Expand Up @@ -154,23 +147,6 @@ public function setFilesystem(FilesystemInterface $filesystem)
];
}

/**
* {@inheritDoc}
*/
public function getInvoker()
{
return $this->invoker;
}

/**
* @param CallInvokerInterface $invoker
* @return void
*/
public function setInvoker(CallInvokerInterface $invoker)
{
$this->invoker = $invoker;
}

/**
* @param string $function
* @param array $args
Expand All @@ -197,7 +173,7 @@ public function callFilesystem($function, $args, $errorResultCode = -1)
*/
public function chmod($path, $mode)
{
return $this->invoker->invokeCall('chmod', [
return $this->callFilesystem('chmod', [
'path' => $path,
'mode' => decoct($mode),
]);
Expand All @@ -210,7 +186,7 @@ public function chmod($path, $mode)
*/
public function mkdir($path, $mode = self::CREATION_MODE)
{
return $this->invoker->invokeCall('mkdir', [
return $this->callFilesystem('mkdir', [
'path' => $path,
'mode' => decoct($this->permissionFlagResolver->resolve($mode)),
]);
Expand Down Expand Up @@ -299,7 +275,7 @@ public function close($fd)
*/
public function getContents($path, $offset = 0, $length = null)
{
return $this->invoker->invokeCall('getContents', [
return $this->callFilesystem('getContents', [
'path' => $path,
'offset' => $offset,
'maxlen' => $length,
Expand All @@ -323,7 +299,7 @@ public function getContents($path, $offset = 0, $length = null)
*/
public function putContents($path, $content)
{
return $this->invoker->invokeCall('putContents', [
return $this->callFilesystem('putContents', [
'path' => $path,
'chunk' => base64_encode($content),
'flags' => 0,
Expand All @@ -346,7 +322,7 @@ public function putContents($path, $content)
*/
public function appendContents($path, $content)
{
return $this->invoker->invokeCall('putContents', [
return $this->callFilesystem('putContents', [
'path' => $path,
'chunk' => base64_encode($content),
'flags' => FILE_APPEND,
Expand All @@ -361,7 +337,7 @@ public function appendContents($path, $content)
*/
public function rmdir($path)
{
return $this->invoker->invokeCall('rmdir', [
return $this->callFilesystem('rmdir', [
'path' => $path,
]);
}
Expand All @@ -372,7 +348,7 @@ public function rmdir($path)
*/
public function unlink($path)
{
return $this->invoker->invokeCall('unlink', [
return $this->callFilesystem('unlink', [
'path' => $path,
]);
}
Expand All @@ -385,7 +361,7 @@ public function unlink($path)
*/
public function chown($path, $uid, $gid)
{
return $this->invoker->invokeCall('chown', [
return $this->callFilesystem('chown', [
'path' => $path,
'uid' => $uid,
'gid' => $gid,
Expand All @@ -398,7 +374,7 @@ public function chown($path, $uid, $gid)
*/
public function stat($filename)
{
return $this->invoker->invokeCall('stat', [
return $this->callFilesystem('stat', [
'path' => $filename,
])->then(function ($stat) {
$stat['atime'] = new DateTime('@' . $stat['atime']);
Expand All @@ -425,7 +401,7 @@ public function lsStream($path)
{
$stream = new ObjectStream();

$this->invoker->invokeCall('readdir', [
$this->callFilesystem('readdir', [
'path' => $path,
'flags' => $this->options['lsFlags'],
])->then(function ($result) use ($path, $stream) {
Expand Down Expand Up @@ -462,7 +438,7 @@ protected function processLsContents($basePath, $result, ObjectStream $stream)
*/
public function touch($path, $mode = self::CREATION_MODE)
{
return $this->invoker->invokeCall('touch', [
return $this->callFilesystem('touch', [
'path' => $path,
'mode' => decoct($this->permissionFlagResolver->resolve($mode)),
]);
Expand All @@ -475,7 +451,7 @@ public function touch($path, $mode = self::CREATION_MODE)
*/
public function rename($fromPath, $toPath)
{
return $this->invoker->invokeCall('rename', [
return $this->callFilesystem('rename', [
'from' => $fromPath,
'to' => $toPath,
]);
Expand All @@ -487,7 +463,7 @@ public function rename($fromPath, $toPath)
*/
public function readlink($path)
{
return $this->invoker->invokeCall('readlink', [
return $this->callFilesystem('readlink', [
'path' => $path,
])->then(function ($result) {
return \React\Promise\resolve($result['path']);
Expand All @@ -501,7 +477,7 @@ public function readlink($path)
*/
public function symlink($fromPath, $toPath)
{
return $this->invoker->invokeCall('symlink', [
return $this->callFilesystem('symlink', [
'from' => $fromPath,
'to' => $toPath,
])->then(function ($result) {
Expand Down
Loading