mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-04 09:04:07 +02:00
cleanup context handling for wrappers
This commit is contained in:
parent
3171a535de
commit
2c8ae56d02
16 changed files with 182 additions and 258 deletions
|
|
@ -63,17 +63,14 @@ class CountWrapper extends Wrapper {
|
|||
if (!is_callable($callback)) {
|
||||
throw new \InvalidArgumentException('Invalid or missing callback');
|
||||
}
|
||||
$context = stream_context_create(array(
|
||||
'count' => array(
|
||||
'source' => $source,
|
||||
'callback' => $callback
|
||||
)
|
||||
));
|
||||
return self::wrapSource($source, $context);
|
||||
return self::wrapSource($source, [
|
||||
'source' => $source,
|
||||
'callback' => $callback
|
||||
]);
|
||||
}
|
||||
|
||||
protected function open() {
|
||||
$context = $this->loadContext('count');
|
||||
$context = $this->loadContext();
|
||||
$this->callback = $context['callback'];
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue