12 class Bz extends \Magento\Framework\Archive\Helper\File
20 if (!extension_loaded(
'bz2')) {
21 throw new \RuntimeException(
'PHP extension bz2 is required.');
23 $this->_fileHandler = bzopen($this->_filePath,
$mode);
25 if (
false === $this->_fileHandler) {
26 throw new \Magento\Framework\Exception\LocalizedException(
27 new \
Magento\Framework\
Phrase(
'The "%1" file failed to open.', [$this->_filePath])
40 throw new \Magento\Framework\Exception\LocalizedException(
41 new \
Magento\Framework\
Phrase(
'The data failed to write to "%1".', [$this->_filePath])
49 protected function _read($length)
51 $data = bzread($this->_fileHandler, $length);
53 if (
false ===
$data) {
54 throw new \Magento\Framework\Exception\LocalizedException(
55 new \
Magento\Framework\
Phrase(
'Failed to read data from %1', [$this->_filePath])
67 bzclose($this->_fileHandler);
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode