static function convertToResource(StreamInterface $stream)
    {
        # register wrapper if not
        $self = new self;
        if(!RegistryOfWrapperStream::isRegistered($self->getLabel()))
            RegistryOfWrapperStream::register($self);

        # make resource
        $mode = new AccessMode();
        (!$stream->isWritable()) ?: $mode->openForWrite();
        (!$stream->isReadable()) ?: $mode->openForRead();

        $label = $self->getLabel();

        $context  = new ContextStreamBase( $label, array('stream' => $stream) );
        $context  = $context->toContext();
        $resource = fopen($label.'://stream'
            , (string) $mode
            , null
            ## set options to wrapper
            , $context
        );

        return $resource;
    }
static function convertToResource(StreamInterface $stream)
    {
        # register wrapper if not
        $self = new self;
        if(!RegistryOfWrapperStream::isRegistered($self->getLabel()))
            RegistryOfWrapperStream::register($self);

        # make resource
        $mode = new AccessMode();
        (!$stream->isWritable()) ?: $mode->openForWrite();
        (!$stream->isReadable()) ?: $mode->openForRead();

        $label = $self->getLabel();

        $context  = new ContextStreamBase( $label, array('stream' => $stream) );
        $context  = $context->toContext();
        $resource = fopen($label.'://stream'
            , (string) $mode
            , null
            ## set options to wrapper
            , $context
        );

        return $resource;
    }
static function convertToResource ( StreamInterface $ stream ) { # register wrapper if not $ self = new self ; if ( ! RegistryOfWrapperStream :: isRegistered ( $ self -> getLabel ( ) ) ) RegistryOfWrapperStream :: register ( $ self ) ; # make resource $ mode = new AccessMode ( ) ; ( ! $ stream -> isWritable ( ) ) ? : $ mode -> openForWrite ( ) ; ( ! $ stream -> isReadable ( ) ) ? : $ mode -> openForRead ( ) ; $ label = $ self -> getLabel ( ) ; $ context = new ContextStreamBase ( $ label , array ( 'stream' => $ stream ) ) ; $ context = $ context -> toContext ( ) ; $ resource = fopen ( $ label . '://stream' , ( string ) $ mode , null ## set options to wrapper , $ context ) ; return $ resource ; }
Convert StreamInterface To PHP resource

@param StreamInterface $stream

@return resource
Convert StreamInterface To PHP resource