yii\mongodb\file\StreamWrapper::stream_open PHP Method

stream_open() public method

This method is called immediately after the wrapper is initialized (f.e. by fopen() and file_get_contents()).
See also: fopen()
public stream_open ( string $path, string $mode, integer $options, string &$openedPath ) : boolean
$path string specifies the URL that was passed to the original function.
$mode string mode used to open the file, as detailed for `fopen()`.
$options integer additional flags set by the streams API.
$openedPath string real opened path.
return boolean whether operation is successful.
    public function stream_open($path, $mode, $options, &$openedPath)
    {
        if ($options & STREAM_USE_PATH) {
            $openedPath = $path;
        }
        $this->parsePath($path);
        switch ($mode) {
            case 'r':
                return $this->prepareDownload();
            case 'w':
                return $this->prepareUpload();
        }
        return false;
    }