public static function wrap(Doozr_Request_File_Stream_Interface $stream)
    {
        static $cache   = [];
        static $replace = ['_', '\\'];

        $handle      = $stream->getHandle();
        $calledClass = get_called_class();
        $protocol    = str_replace($replace, '-', $calledClass);

        // Register the stream wrapper decorator if needed. Cached - registering + checking wrappers is expensive.
        if (false === isset($cache[$protocol])) {
            self::registerProtocol($protocol, $calledClass);
            $cache[$protocol] = true;
        }

        $wrapper = fopen(
            $protocol.'://',
            stream_get_meta_data($handle)['mode'],
            null,
            stream_context_create(
                [DOOZR_NAMESPACE_FLAT => ['stream' => $handle]]
            )
        );

        if (false === $wrapper) {
            throw new RuntimeException(
                sprintf('Unable to wrap the stream with custom protocol: %s.', $protocol)
            );
        }

        return $wrapper;
    }
public static function wrap(Doozr_Request_File_Stream_Interface $stream)
    {
        static $cache   = [];
        static $replace = ['_', '\\'];

        $handle      = $stream->getHandle();
        $calledClass = get_called_class();
        $protocol    = str_replace($replace, '-', $calledClass);

        // Register the stream wrapper decorator if needed. Cached - registering + checking wrappers is expensive.
        if (false === isset($cache[$protocol])) {
            self::registerProtocol($protocol, $calledClass);
            $cache[$protocol] = true;
        }

        $wrapper = fopen(
            $protocol.'://',
            stream_get_meta_data($handle)['mode'],
            null,
            stream_context_create(
                [DOOZR_NAMESPACE_FLAT => ['stream' => $handle]]
            )
        );

        if (false === $wrapper) {
            throw new RuntimeException(
                sprintf('Unable to wrap the stream with custom protocol: %s.', $protocol)
            );
        }

        return $wrapper;
    }
public static function wrap ( Doozr_Request_File_Stream_Interface $ stream ) { static $ cache = [ ] ; static $ replace = [ '_' , '\\' ] ; $ handle = $ stream -> getHandle ( ) ; $ calledClass = get_called_class ( ) ; $ protocol = str_replace ( $ replace , '-' , $ calledClass ) ; // Register the stream wrapper decorator if needed. Cached - registering + checking wrappers is expensive. if ( false === isset ( $ cache [ $ protocol ] ) ) { self :: registerProtocol ( $ protocol , $ calledClass ) ; $ cache [ $ protocol ] = true ; } $ wrapper = fopen ( $ protocol . '://' , stream_get_meta_data ( $ handle ) [ 'mode' ] , null , stream_context_create ( [ DOOZR_NAMESPACE_FLAT => [ 'stream' => $ handle ] ] ) ) ; if ( false === $ wrapper ) { throw new RuntimeException ( sprintf ( 'Unable to wrap the stream with custom protocol: %s.' , $ protocol ) ) ; } return $ wrapper ; }
Wraps a passed stream into an stream resource handable by PHP's internal functions.

@param Doozr_Request_File_Stream_Interface $stream The stream to get getUploadedFiles from for wrapping

@author Benjamin Carl <opensource@clickalicious.de>
@return resource The wrapped resource
@access public
@static
Wraps a passed stream into an stream resource handable by PHP s internal functions .