protected function storeFile($data, $filePath)
    {
        // create a folder for message if needed
        if (!is_dir(dirname($filePath))) {
            $this->createFolder(dirname($filePath));
        }

        /** @noinspection LoopWhichDoesNotLoopInspection */
        for ($i = 0; $i < $this->_config->getHostRetryLimit(); $i++) {
            /* We try an exclusive creation of the file.
             * This is an atomic operation, it avoid locking mechanism
             */
            $fp = @fopen($filePath, 'x');

            if($fp !== false) {
                if (false === fwrite($fp, $data)) {
                    return false;
                }

                fclose($fp);

                return $filePath;
            }
        }

        throw new FileSystemException(
            new Phrase('Unable to create a file for enqueuing Message')
        );
    }
protected function storeFile($data, $filePath)
    {
        // create a folder for message if needed
        if (!is_dir(dirname($filePath))) {
            $this->createFolder(dirname($filePath));
        }

        /** @noinspection LoopWhichDoesNotLoopInspection */
        for ($i = 0; $i < $this->_config->getHostRetryLimit(); $i++) {
            /* We try an exclusive creation of the file.
             * This is an atomic operation, it avoid locking mechanism
             */
            $fp = @fopen($filePath, 'x');

            if($fp !== false) {
                if (false === fwrite($fp, $data)) {
                    return false;
                }

                fclose($fp);

                return $filePath;
            }
        }

        throw new FileSystemException(
            new Phrase('Unable to create a file for enqueuing Message')
        );
    }
protected function storeFile ( $ data , $ filePath ) { // create a folder for message if needed if ( ! is_dir ( dirname ( $ filePath ) ) ) { $ this -> createFolder ( dirname ( $ filePath ) ) ; } /** @noinspection LoopWhichDoesNotLoopInspection */ for ( $ i = 0 ; $ i < $ this -> _config -> getHostRetryLimit ( ) ; $ i ++ ) { /* We try an exclusive creation of the file.
             * This is an atomic operation, it avoid locking mechanism
             */ $ fp = @ fopen ( $ filePath , 'x' ) ; if ( $ fp !== false ) { if ( false === fwrite ( $ fp , $ data ) ) { return false ; } fclose ( $ fp ) ; return $ filePath ; } } throw new FileSystemException ( new Phrase ( 'Unable to create a file for enqueuing Message' ) ) ; }
Stores string data at a given path

@param $data
@param $filePath
@return bool
@throws \Magento\Framework\Exception\FileSystemException
@throws \Exception
Stores string data at a given path