mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-04 00:54:08 +02:00
add PathWrapper to get a virtual path for an existing file
This commit is contained in:
parent
d3620e8dc4
commit
5981b1b39c
4 changed files with 55 additions and 5 deletions
|
|
@ -56,7 +56,7 @@ class 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;
|
||||
}
|
||||
|
|
@ -71,13 +71,14 @@ class Path {
|
|||
/**
|
||||
* Add values to the default stream context
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $values
|
||||
*/
|
||||
protected function appendDefaultContent($key, $values) {
|
||||
protected function appendDefaultContent($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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue