chore: complete update

This commit is contained in:
2025-07-17 16:24:20 +02:00
parent 899227b0a4
commit 64a7051137
1300 changed files with 85570 additions and 2756 deletions

View File

@@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
namespace Archive\StreamWrapper\Context;
/**
* Wrapper für Stream-Context-Optionen
*/
final class StreamContext
{
private array $options = [];
private array $params = [];
public function __construct($resource = null)
{
if ($resource !== null) {
$this->options = stream_context_get_options($resource);
$this->params = stream_context_get_params($resource);
}
}
/**
* Gibt eine Option für das angegebene Protokoll zurück
*/
public function getOption(string $protocol, string $key, $default = null)
{
return $this->options[$protocol][$key] ?? $default;
}
/**
* Gibt alle Optionen für ein Protokoll zurück
*/
public function getProtocolOptions(string $protocol): array
{
return $this->options[$protocol] ?? [];
}
/**
* Setzt eine Option für das angegebene Protokoll
*/
public function setOption(string $protocol, string $key, $value): self
{
$this->options[$protocol][$key] = $value;
return $this;
}
/**
* Gibt einen Parameter zurück
*/
public function getParam(string $key, $default = null)
{
return $this->params[$key] ?? $default;
}
/**
* Setzt einen Parameter
*/
public function setParam(string $key, $value): self
{
$this->params[$key] = $value;
return $this;
}
/**
* Gibt alle Optionen zurück
*/
public function getAllOptions(): array
{
return $this->options;
}
/**
* Gibt alle Parameter zurück
*/
public function getAllParams(): array
{
return $this->params;
}
/**
* Erstellt einen neuen Stream-Context mit den aktuellen Optionen
*/
public function createResource()
{
return stream_context_create($this->options, $this->params);
}
}