Components/FileService/Csv/CsvConfigurableStepsProvider.php
protected function getFileHandle($fullPath, $mode)
    {
        $key = md5($fullPath.$mode);
        if (array_key_exists($key, $this->openFileHandles)) {
            $handle = $this->openFileHandles[$key];
        } else {
            $handle = fopen($fullPath, $mode);
            $this->openFileHandles[$key] = $handle;
        }

        if ('stream' !== get_resource_type($handle)) {
            throw new \Exception('The file handle is not a file stream!');
        }

        if (false !== strpos($mode, 'w')) {
            if ('stream' === !is_writeable($fullPath)) {
                throw new \Exception('The file handle in the context is not writeable!');
            }
        }

        return $handle;
    }
protected function getFileHandle($fullPath, $mode)
    {
        $key = md5($fullPath.$mode);
        if (array_key_exists($key, $this->openFileHandles)) {
            $handle = $this->openFileHandles[$key];
        } else {
            $handle = fopen($fullPath, $mode);
            $this->openFileHandles[$key] = $handle;
        }

        if ('stream' !== get_resource_type($handle)) {
            throw new \Exception('The file handle is not a file stream!');
        }

        if (false !== strpos($mode, 'w')) {
            if ('stream' === !is_writeable($fullPath)) {
                throw new \Exception('The file handle in the context is not writeable!');
            }
        }

        return $handle;
    }
protected function getFileHandle ( $ fullPath , $ mode ) { $ key = md5 ( $ fullPath . $ mode ) ; if ( array_key_exists ( $ key , $ this -> openFileHandles ) ) { $ handle = $ this -> openFileHandles [ $ key ] ; } else { $ handle = fopen ( $ fullPath , $ mode ) ; $ this -> openFileHandles [ $ key ] = $ handle ; } if ( 'stream' !== get_resource_type ( $ handle ) ) { throw new \ Exception ( 'The file handle is not a file stream!' ) ; } if ( false !== strpos ( $ mode , 'w' ) ) { if ( 'stream' === ! is_writeable ( $ fullPath ) ) { throw new \ Exception ( 'The file handle in the context is not writeable!' ) ; } } return $ handle ; }
Open a file handle and store the hash so we can reuse it.

@param $fullPath
@param $mode

@return resource

@throws \Exception
Open a file handle and store the hash so we can reuse it .