Skip to content

Commit

Permalink
Remove traces of call invokers
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Oct 6, 2019
1 parent 4e2af61 commit 4d186f1
Show file tree
Hide file tree
Showing 26 changed files with 260 additions and 1,273 deletions.
6 changes: 3 additions & 3 deletions examples/directory_ls.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

$filesystem = \React\Filesystem\Filesystem::create($loop);
echo 'Using ', get_class($filesystem->getAdapter()), PHP_EOL;
$filesystem->dir(__DIR__ . DIRECTORY_SEPARATOR . 'tmp')->ls()->then(function (array $list) {
$filesystem->dir(__DIR__)->ls()->then(function (array $list) {
foreach ($list as $node) {
echo get_class($node), ': ', $node->getPath(), PHP_EOL;
}
}, function ($e) {
echo $e->getMessage(), PHP_EOL;
})->then(null, function ($error) {
echo (string)$error;
});

$loop->run();
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
processIsolation="true"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
Expand Down
8 changes: 0 additions & 8 deletions src/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ public function getLoop();
*/
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.

38 changes: 11 additions & 27 deletions src/ChildProcess/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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 @@ -64,11 +63,6 @@ class Adapter implements AdapterInterface
*/
protected $permissionFlagResolver;

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

/**
* @var array
*/
Expand All @@ -85,7 +79,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 @@ -145,15 +138,6 @@ public function setFilesystem(FilesystemInterface $filesystem)
];
}

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

/**
* @param string $function
* @param array $args
Expand All @@ -176,7 +160,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 @@ -189,7 +173,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 @@ -271,7 +255,7 @@ public function close($fd)
*/
public function rmdir($path)
{
return $this->invoker->invokeCall('rmdir', [
return $this->callFilesystem('rmdir', [
'path' => $path,
]);
}
Expand All @@ -282,7 +266,7 @@ public function rmdir($path)
*/
public function unlink($path)
{
return $this->invoker->invokeCall('unlink', [
return $this->callFilesystem('unlink', [
'path' => $path,
]);
}
Expand All @@ -295,7 +279,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 @@ -308,7 +292,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 @@ -335,7 +319,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 @@ -372,7 +356,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 @@ -385,7 +369,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 @@ -397,7 +381,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 @@ -411,7 +395,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

0 comments on commit 4d186f1

Please sign in to comment.