mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-03 16:44:07 +02:00
autodetect class and protocol
This commit is contained in:
parent
2538e6d05c
commit
3171a535de
12 changed files with 28 additions and 15 deletions
|
|
@ -25,7 +25,19 @@ abstract class Wrapper implements File, Directory {
|
|||
*/
|
||||
protected $source;
|
||||
|
||||
protected static function wrapSource($source, $context, $protocol, $class) {
|
||||
/**
|
||||
* @param $source
|
||||
* @param $context
|
||||
* @param null $protocol deprecated, protocol is now automatically generated
|
||||
* @param null $class deprecated, class is now automatically generated
|
||||
* @return bool|resource
|
||||
*/
|
||||
protected static function wrapSource($source, $context, $protocol = null, $class = null) {
|
||||
if ($class === null) {
|
||||
$class = static::class;
|
||||
}
|
||||
$parts = explode('\\', $class);
|
||||
$protocol = strtolower(array_pop($parts));
|
||||
if (!is_resource($source)) {
|
||||
throw new \BadMethodCallException();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue