src/VCR/Util/StreamProcessor.php
public function stream_open($path, $mode, $options, &$openedPath)
    {
        // file_exists catches paths like /dev/urandom that are missed by is_file.
        if ('r' === substr($mode, 0, 1) && !file_exists($path)) {
            return false;
        }

        $this->restore();

        if (isset($this->context)) {
            $this->resource = fopen($path, $mode, $options & STREAM_USE_PATH, $this->context);
        } else {
            $this->resource = fopen($path, $mode, $options & STREAM_USE_PATH);
        }

        if ($options & self::STREAM_OPEN_FOR_INCLUDE && $this->shouldProcess($path)) {
            $this->appendFiltersToStream($this->resource);
        }

        $this->intercept();

        return $this->resource !== false;
    }
public function stream_open($path, $mode, $options, &$openedPath)
    {
        // file_exists catches paths like /dev/urandom that are missed by is_file.
        if ('r' === substr($mode, 0, 1) && !file_exists($path)) {
            return false;
        }

        $this->restore();

        if (isset($this->context)) {
            $this->resource = fopen($path, $mode, $options & STREAM_USE_PATH, $this->context);
        } else {
            $this->resource = fopen($path, $mode, $options & STREAM_USE_PATH);
        }

        if ($options & self::STREAM_OPEN_FOR_INCLUDE && $this->shouldProcess($path)) {
            $this->appendFiltersToStream($this->resource);
        }

        $this->intercept();

        return $this->resource !== false;
    }
public function stream_open ( $ path , $ mode , $ options , & $ openedPath ) { // file_exists catches paths like /dev/urandom that are missed by is_file. if ( 'r' === substr ( $ mode , 0 , 1 ) && ! file_exists ( $ path ) ) { return false ; } $ this -> restore ( ) ; if ( isset ( $ this -> context ) ) { $ this -> resource = fopen ( $ path , $ mode , $ options & STREAM_USE_PATH , $ this -> context ) ; } else { $ this -> resource = fopen ( $ path , $ mode , $ options & STREAM_USE_PATH ) ; } if ( $ options & self :: STREAM_OPEN_FOR_INCLUDE && $ this -> shouldProcess ( $ path ) ) { $ this -> appendFiltersToStream ( $ this -> resource ) ; } $ this -> intercept ( ) ; return $ this -> resource !== false ; }
Opens a stream and attaches registered filters.

@param  string  $path       Specifies the URL that was passed to the original function.
@param  string  $mode       The mode used to open the file, as detailed for fopen().
@param  integer $options    Holds additional flags set by the streams API.
It can hold one or more of the following values OR'd together.
@param  string  $openedPath If the path is opened successfully, and STREAM_USE_PATH is set in options,
opened_path should be set to the full path of the file/resource that was
actually opened.

@return boolean Returns TRUE on success or FALSE on failure.
Opens a stream and attaches registered filters .