public function stream_open($path, $mode, $options, &$opened_path)
    {
        $contents = self::cache()->get($path);
        $fileExists = (false !== $contents);

        switch ($mode) {
            case 'r':
            case 'rb':
            case 'r+':
            case 'rb+':
                if (! $fileExists) {
                    return false;
                }

                $this->fd = fopen('php://memory', "wb+");
                fwrite($this->fd, $contents);
                fseek($this->fd, 0, SEEK_SET);
                break;

            case 'w':
            case 'wb':
            case 'w+':
            case 'wb+':
                $this->fd = fopen('php://memory', "wb+");
                break;

            case 'a':
            case 'ab':
            case 'a+':
            case 'ab+':
                $this->fd = fopen('php://memory', "wb+");

                if ($fileExists) {
                    fwrite($this->fd, $contents);
                    fseek($this->fd, 0, SEEK_END);
                }
                break;

            default:
                return false;
        }

        $this->path = $path;
        $this->mode = $mode;

        return true;
    }
public function stream_open($path, $mode, $options, &$opened_path)
    {
        $contents = self::cache()->get($path);
        $fileExists = (false !== $contents);

        switch ($mode) {
            case 'r':
            case 'rb':
            case 'r+':
            case 'rb+':
                if (! $fileExists) {
                    return false;
                }

                $this->fd = fopen('php://memory', "wb+");
                fwrite($this->fd, $contents);
                fseek($this->fd, 0, SEEK_SET);
                break;

            case 'w':
            case 'wb':
            case 'w+':
            case 'wb+':
                $this->fd = fopen('php://memory', "wb+");
                break;

            case 'a':
            case 'ab':
            case 'a+':
            case 'ab+':
                $this->fd = fopen('php://memory', "wb+");

                if ($fileExists) {
                    fwrite($this->fd, $contents);
                    fseek($this->fd, 0, SEEK_END);
                }
                break;

            default:
                return false;
        }

        $this->path = $path;
        $this->mode = $mode;

        return true;
    }
public function stream_open ( $ path , $ mode , $ options , & $ opened_path ) { $ contents = self :: cache ( ) -> get ( $ path ) ; $ fileExists = ( false !== $ contents ) ; switch ( $ mode ) { case 'r' : case 'rb' : case 'r+' : case 'rb+' : if ( ! $ fileExists ) { return false ; } $ this -> fd = fopen ( 'php://memory' , "wb+" ) ; fwrite ( $ this -> fd , $ contents ) ; fseek ( $ this -> fd , 0 , SEEK_SET ) ; break ; case 'w' : case 'wb' : case 'w+' : case 'wb+' : $ this -> fd = fopen ( 'php://memory' , "wb+" ) ; break ; case 'a' : case 'ab' : case 'a+' : case 'ab+' : $ this -> fd = fopen ( 'php://memory' , "wb+" ) ; if ( $ fileExists ) { fwrite ( $ this -> fd , $ contents ) ; fseek ( $ this -> fd , 0 , SEEK_END ) ; } break ; default : return false ; } $ this -> path = $ path ; $ this -> mode = $ mode ; return true ; }
Opens a stream.

@param $path
@param $mode
@param $options
@param $opened_path
@return bool true on success, false otherwise.
@throws RuntimeException
Opens a stream .