Skip to content

Commit

Permalink
update icewind/streams to 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Jan 19, 2017
1 parent ae67e91 commit f918b1f
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 55 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"symfony/process": "^3.0.0",
"pimple/pimple": "3.0.2",
"nikic/php-parser": "1.4.1",
"icewind/Streams": "0.4.1",
"icewind/Streams": "0.5.2",
"swiftmailer/swiftmailer": "@stable",
"guzzlehttp/guzzle": "~5.3",
"league/flysystem": "1.0.20",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,23 @@
'Icewind\\Streams\\IteratorDirectory' => $vendorDir . '/icewind/streams/src/IteratorDirectory.php',
'Icewind\\Streams\\NullWrapper' => $vendorDir . '/icewind/streams/src/NullWrapper.php',
'Icewind\\Streams\\Path' => $vendorDir . '/icewind/streams/src/Path.php',
'Icewind\\Streams\\PathWrapper' => $vendorDir . '/icewind/streams/src/PathWrapper.php',
'Icewind\\Streams\\RetryWrapper' => $vendorDir . '/icewind/streams/src/RetryWrapper.php',
'Icewind\\Streams\\SeekableWrapper' => $vendorDir . '/icewind/streams/src/SeekableWrapper.php',
'Icewind\\Streams\\Tests\\CallbackWrapper' => $vendorDir . '/icewind/streams/tests/CallbackWrapper.php',
'Icewind\\Streams\\Tests\\DirectoryFilter' => $vendorDir . '/icewind/streams/tests/DirectoryFilter.php',
'Icewind\\Streams\\Tests\\DirectoryWrapper' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php',
'Icewind\\Streams\\Tests\\DirectoryWrapperDummy' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php',
'Icewind\\Streams\\Tests\\DirectoryWrapperNull' => $vendorDir . '/icewind/streams/tests/DirectoryWrapper.php',
'Icewind\\Streams\\Tests\\FailWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php',
'Icewind\\Streams\\Tests\\IteratorDirectory' => $vendorDir . '/icewind/streams/tests/IteratorDirectory.php',
'Icewind\\Streams\\Tests\\NullWrapper' => $vendorDir . '/icewind/streams/tests/NullWrapper.php',
'Icewind\\Streams\\Tests\\PartialWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php',
'Icewind\\Streams\\Tests\\PathWrapper' => $vendorDir . '/icewind/streams/tests/PathWrapper.php',
'Icewind\\Streams\\Tests\\RetryWrapper' => $vendorDir . '/icewind/streams/tests/RetryWrapper.php',
'Icewind\\Streams\\Tests\\SeekableWrapper' => $vendorDir . '/icewind/streams/tests/SeekableWrapper.php',
'Icewind\\Streams\\Tests\\UrlCallBack' => $vendorDir . '/icewind/streams/tests/UrlCallBack.php',
'Icewind\\Streams\\Tests\\Wrapper' => $vendorDir . '/icewind/streams/tests/Wrapper.php',
'Icewind\\Streams\\Url' => $vendorDir . '/icewind/streams/src/Url.php',
'Icewind\\Streams\\UrlCallback' => $vendorDir . '/icewind/streams/src/UrlCallBack.php',
'Icewind\\Streams\\Wrapper' => $vendorDir . '/icewind/streams/src/Wrapper.php',
Expand Down
15 changes: 15 additions & 0 deletions composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,23 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
'Icewind\\Streams\\IteratorDirectory' => __DIR__ . '/..' . '/icewind/streams/src/IteratorDirectory.php',
'Icewind\\Streams\\NullWrapper' => __DIR__ . '/..' . '/icewind/streams/src/NullWrapper.php',
'Icewind\\Streams\\Path' => __DIR__ . '/..' . '/icewind/streams/src/Path.php',
'Icewind\\Streams\\PathWrapper' => __DIR__ . '/..' . '/icewind/streams/src/PathWrapper.php',
'Icewind\\Streams\\RetryWrapper' => __DIR__ . '/..' . '/icewind/streams/src/RetryWrapper.php',
'Icewind\\Streams\\SeekableWrapper' => __DIR__ . '/..' . '/icewind/streams/src/SeekableWrapper.php',
'Icewind\\Streams\\Tests\\CallbackWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/CallbackWrapper.php',
'Icewind\\Streams\\Tests\\DirectoryFilter' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryFilter.php',
'Icewind\\Streams\\Tests\\DirectoryWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php',
'Icewind\\Streams\\Tests\\DirectoryWrapperDummy' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php',
'Icewind\\Streams\\Tests\\DirectoryWrapperNull' => __DIR__ . '/..' . '/icewind/streams/tests/DirectoryWrapper.php',
'Icewind\\Streams\\Tests\\FailWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php',
'Icewind\\Streams\\Tests\\IteratorDirectory' => __DIR__ . '/..' . '/icewind/streams/tests/IteratorDirectory.php',
'Icewind\\Streams\\Tests\\NullWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/NullWrapper.php',
'Icewind\\Streams\\Tests\\PartialWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php',
'Icewind\\Streams\\Tests\\PathWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/PathWrapper.php',
'Icewind\\Streams\\Tests\\RetryWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/RetryWrapper.php',
'Icewind\\Streams\\Tests\\SeekableWrapper' => __DIR__ . '/..' . '/icewind/streams/tests/SeekableWrapper.php',
'Icewind\\Streams\\Tests\\UrlCallBack' => __DIR__ . '/..' . '/icewind/streams/tests/UrlCallBack.php',
'Icewind\\Streams\\Tests\\Wrapper' => __DIR__ . '/..' . '/icewind/streams/tests/Wrapper.php',
'Icewind\\Streams\\Url' => __DIR__ . '/..' . '/icewind/streams/src/Url.php',
'Icewind\\Streams\\UrlCallback' => __DIR__ . '/..' . '/icewind/streams/src/UrlCallBack.php',
'Icewind\\Streams\\Wrapper' => __DIR__ . '/..' . '/icewind/streams/src/Wrapper.php',
Expand Down
86 changes: 43 additions & 43 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1753,49 +1753,6 @@
"minification"
]
},
{
"name": "icewind/streams",
"version": "0.4.1",
"version_normalized": "0.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/Streams.git",
"reference": "d3620e8dc410c86c2ba55579803679c4e0b289ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/d3620e8dc410c86c2ba55579803679c4e0b289ac",
"reference": "d3620e8dc410c86c2ba55579803679c4e0b289ac",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
},
"time": "2016-06-02T14:37:52+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Icewind\\Streams\\Tests\\": "tests/",
"Icewind\\Streams\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Robin Appelman",
"email": "[email protected]"
}
],
"description": "A set of generic stream wrappers"
},
{
"name": "guzzlehttp/guzzle",
"version": "5.3.1",
Expand Down Expand Up @@ -3044,5 +3001,48 @@
"scss",
"stylesheet"
]
},
{
"name": "icewind/streams",
"version": "0.5.2",
"version_normalized": "0.5.2.0",
"source": {
"type": "git",
"url": "https://github.com/icewind1991/Streams.git",
"reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/icewind1991/Streams/zipball/6bfd2fdbd99319f5e010d0a684409189a562cb1e",
"reference": "6bfd2fdbd99319f5e010d0a684409189a562cb1e",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"satooshi/php-coveralls": "v1.0.0"
},
"time": "2016-12-02T14:21:23+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Icewind\\Streams\\Tests\\": "tests/",
"Icewind\\Streams\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Robin Appelman",
"email": "[email protected]"
}
],
"description": "A set of generic stream wrappers"
}
]
2 changes: 2 additions & 0 deletions icewind/streams/src/CallbackWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public function stream_close() {
$result = parent::stream_close();
if (is_callable($this->closeCallback)) {
call_user_func($this->closeCallback);
// prevent further calls by potential PHP 7 GC ghosts
$this->closeCallback = null;
}
return $result;
}
Expand Down
12 changes: 8 additions & 4 deletions icewind/streams/src/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function wrapPath($path) {

protected function register() {
if (!$this->registered) {
$this->appendDefaultContent($this->getProtocol(), $this->contextOptions);
$this->appendDefaultContent($this->contextOptions);
stream_wrapper_register($this->getProtocol(), $this->class);
$this->registered = true;
}
Expand All @@ -71,13 +71,17 @@ protected function unregister() {
/**
* Add values to the default stream context
*
* @param string $key
* @param array $values
*/
protected function appendDefaultContent($key, $values) {
protected function appendDefaultContent($values) {
if (!is_array(current($values))) {
$values = array($this->getProtocol() => $values);
}
$context = stream_context_get_default();
$defaults = stream_context_get_options($context);
$defaults[$key] = $values;
foreach ($values as $key => $value) {
$defaults[$key] = $value;
}
stream_context_set_default($defaults);
}

Expand Down
25 changes: 25 additions & 0 deletions icewind/streams/src/PathWrapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Copyright (c) 2016 Robin Appelman <[email protected]>
* This file is licensed under the Licensed under the MIT license:
* http://opensource.org/licenses/MIT
*/

namespace Icewind\Streams;

/**
* A string-like object that maps to an existing stream when opened
*/
class PathWrapper extends NullWrapper {
/**
* @param resource $source
* @return Path|string
*/
public static function getPath($source) {
return new Path(__CLASS__, [
'null' => [
'source' => $source
]
]);
}
}
2 changes: 1 addition & 1 deletion icewind/streams/src/Wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function loadContext($name) {
if (isset($context[$name])) {
$context = $context[$name];
} else {
throw new \BadMethodCallException('Invalid context, "callable" options not set');
throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set');
}
if (isset($context['source']) and is_resource($context['source'])) {
$this->setSourceStream($context['source']);
Expand Down

0 comments on commit f918b1f

Please sign in to comment.