formatting

This commit is contained in:
Robin Appelman 2021-03-02 19:25:43 +01:00
commit fdc0e3f113
21 changed files with 118 additions and 111 deletions

View file

@ -63,11 +63,11 @@ class CallbackWrapper extends Wrapper {
*/
public static function wrap($source, $read = null, $write = null, $close = null, $readDir = null, $preClose = null) {
$context = [
'source' => $source,
'read' => $read,
'write' => $write,
'close' => $close,
'readDir' => $readDir,
'source' => $source,
'read' => $read,
'write' => $write,
'close' => $close,
'readDir' => $readDir,
'preClose' => $preClose,
];
return self::wrapSource($source, $context);

View file

@ -64,7 +64,7 @@ class CountWrapper extends Wrapper {
throw new \InvalidArgumentException('Invalid or missing callback');
}
return self::wrapSource($source, [
'source' => $source,
'source' => $source,
'callback' => $callback
]);
}

View file

@ -23,7 +23,6 @@
namespace Icewind\Streams;
abstract class HashWrapper extends Wrapper {
/**
@ -48,7 +47,7 @@ abstract class HashWrapper extends Wrapper {
*/
public static function wrap($source, $hash, $callback) {
$context = [
'hash' => $hash,
'hash' => $hash,
'callback' => $callback,
];
return self::wrapSource($source, $context);
@ -76,5 +75,4 @@ abstract class HashWrapper extends Wrapper {
}
return parent::stream_close();
}
}
}

View file

@ -42,7 +42,7 @@ class IteratorDirectory extends WrapperHandler implements Directory {
$context = parent::loadContext($name);
if (isset($context['iterator'])) {
$this->iterator = $context['iterator'];
} else if (isset($context['array'])) {
} elseif (isset($context['array'])) {
$this->iterator = new \ArrayIterator($context['array']);
} else {
throw new \BadMethodCallException('Invalid context, iterator or array not set');
@ -101,7 +101,7 @@ class IteratorDirectory extends WrapperHandler implements Directory {
$options = [
'iterator' => $source
];
} else if (is_array($source)) {
} elseif (is_array($source)) {
$options = [
'array' => $source
];

View file

@ -63,7 +63,7 @@ class SeekableWrapper extends Wrapper {
public function stream_seek($offset, $whence = SEEK_SET) {
if ($whence === SEEK_SET) {
$target = $offset;
} else if ($whence === SEEK_CUR) {
} elseif ($whence === SEEK_CUR) {
$current = ftell($this->cache);
$target = $current + $offset;
} else {

View file

@ -48,17 +48,25 @@ class UrlCallback extends Wrapper implements Url {
*
* @throws \BadMethodCallException
*/
public static function wrap($source, $fopen = null, $opendir = null, $mkdir = null, $rename = null, $rmdir = null,
$unlink = null, $stat = null) {
public static function wrap(
$source,
$fopen = null,
$opendir = null,
$mkdir = null,
$rename = null,
$rmdir = null,
$unlink = null,
$stat = null
) {
return new Path(static::class, [
'source' => $source,
'fopen' => $fopen,
'source' => $source,
'fopen' => $fopen,
'opendir' => $opendir,
'mkdir' => $mkdir,
'rename' => $rename,
'rmdir' => $rmdir,
'unlink' => $unlink,
'stat' => $stat
'mkdir' => $mkdir,
'rename' => $rename,
'rmdir' => $rmdir,
'unlink' => $unlink,
'stat' => $stat
]);
}

View file

@ -21,7 +21,6 @@
namespace Icewind\Streams;
class WrapperHandler {
const NO_SOURCE_DIR = 1;

View file

@ -34,4 +34,4 @@ class WriteHashWrapper extends HashWrapper {
$this->updateHash($data);
return parent::stream_write($data);
}
}
}