Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Bz.php
Go to the documentation of this file.
1 <?php
11 
12 class Bz extends \Magento\Framework\Archive\Helper\File
13 {
18  protected function _open($mode)
19  {
20  if (!extension_loaded('bz2')) {
21  throw new \RuntimeException('PHP extension bz2 is required.');
22  }
23  $this->_fileHandler = bzopen($this->_filePath, $mode);
24 
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])
28  );
29  }
30  }
31 
35  protected function _write($data)
36  {
37  $result = bzwrite($this->_fileHandler, $data);
38 
39  if (false === $result) {
40  throw new \Magento\Framework\Exception\LocalizedException(
41  new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath])
42  );
43  }
44  }
45 
49  protected function _read($length)
50  {
51  $data = bzread($this->_fileHandler, $length);
52 
53  if (false === $data) {
54  throw new \Magento\Framework\Exception\LocalizedException(
55  new \Magento\Framework\Phrase('Failed to read data from %1', [$this->_filePath])
56  );
57  }
58 
59  return $data;
60  }
61 
65  protected function _close()
66  {
67  bzclose($this->_fileHandler);
68  }
69 }
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
Definition: grid.phtml:15